Define ROS2 demo functions when flag is off

This commit is contained in:
PabloVD 2024-05-21 13:52:01 +02:00 committed by Blyron
parent e1cfe639fc
commit 763fd521a9
2 changed files with 4 additions and 4 deletions

View File

@ -200,20 +200,22 @@ std::string ROS2::GetActorParentRosName(void *actor) {
return std::string("");
}
#if defined(WITH_ROS2_DEMO)
void ROS2::AddBasicSubscriberCallback(void* actor, std::string ros_name, ActorMessageCallback callback) {
#if defined(WITH_ROS2_DEMO)
_actor_message_callbacks.insert({actor, std::move(callback)});
_basic_subscriber.reset();
_basic_subscriber = std::make_shared<BasicSubscriber>(actor, ros_name.c_str());
_basic_subscriber->Init();
#endif
}
void ROS2::RemoveBasicSubscriberCallback(void* actor) {
#if defined(WITH_ROS2_DEMO)
_basic_subscriber.reset();
_actor_message_callbacks.erase(actor);
#endif
}
#endif
void ROS2::AddActorCallback(void* actor, std::string ros_name, ActorCallback callback) {
_actor_callbacks.insert({actor, std::move(callback)});

View File

@ -74,10 +74,8 @@ class ROS2
// callbacks
void AddActorCallback(void* actor, std::string ros_name, ActorCallback callback);
void RemoveActorCallback(void* actor);
#if defined(WITH_ROS2_DEMO)
void RemoveBasicSubscriberCallback(void* actor);
void AddBasicSubscriberCallback(void* actor, std::string ros_name, ActorMessageCallback callback);
#endif
// enabling streams to publish
void EnableStream(carla::streaming::detail::stream_id_type id) { _publish_stream.insert(id); }