39 carla::Buffer buf((
unsigned char *) map.c_str(), (size_t) map.size() + 1);
50 auto response = fut.get();
51 token_type new_token(*reinterpret_cast<carla::streaming::detail::token_data *>(response.buffer.data()));
58 std::string msg(
"Are you alive?");
59 carla::Buffer buf((
unsigned char *) msg.c_str(), (size_t) msg.size());
60 log_info(
"sending is alive command");
62 auto response = fut.get();
63 log_info(
"response from alive command: ", response.buffer.data());
74 auto response = fut.get();
75 bool res = (*
reinterpret_cast<bool *
>(response.buffer.data()));
77 log_error(
"enable_for_ros for sensor", sensor_id,
" not found on any server");
89 auto response = fut.get();
90 bool res = (*
reinterpret_cast<bool *
>(response.buffer.data()));
92 log_error(
"disable_for_ros for sensor", sensor_id,
" not found on any server");
104 auto response = fut.get();
105 bool res = (*
reinterpret_cast<bool *
>(response.buffer.data()));
108 log_error(
"is_enabled_for_ros for sensor", sensor_id,
" not found on any server");
115 auto it =
_tokens.find(sensor_id);
118 log_debug(
"Using token from already activated sensor: ", it->second.get_stream_id(),
", ", it->second.get_port());
123 auto server =
_router->GetNextServer();
128 log_debug(
"Using token from new activated sensor: ", token.get_stream_id(),
", ", token.get_port());
void DisableForROS(stream_id sensor_id)
std::unordered_map< stream_id, std::weak_ptr< Primary > > _servers
token_type SendGetToken(carla::streaming::detail::stream_id_type sensor_id)
void SendLoadMap(std::string map)
static void log_error(Args &&... args)
This file contains definitions of common data structures used in traffic manager. ...
std::unordered_map< stream_id, token_type > _tokens
void SendEnableForROS(stream_id sensor_id)
static void log_debug(Args &&...)
Serializes a stream endpoint.
carla::streaming::detail::stream_id_type stream_id
static void log_info(Args &&... args)
void EnableForROS(stream_id sensor_id)
token_type GetToken(stream_id sensor_id)
std::shared_ptr< Router > _router
const auto & get_stream_id() const
bool IsEnabledForROS(stream_id sensor_id)
void SendFrameData(carla::Buffer buffer)
void SendDisableForROS(stream_id sensor_id)
bool SendIsEnabledForROS(stream_id sensor_id)
void set_router(std::shared_ptr< Router > router)