CARLA
 
载入中...
搜索中...
未找到
primaryCommands.h
浏览该文件的文档.
1// Copyright (c) 2022 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9// #include "carla/Logging.h"
15
16namespace carla {
17namespace multigpu {
18
19// using session = std::shared_ptr<Primary>;
20// using callback_response = std::function<void(std::shared_ptr<Primary>, carla::Buffer)>;
23
24class Router;
25
27 public:
28
29
31 PrimaryCommands(std::shared_ptr<Router> router);
32
33 void set_router(std::shared_ptr<Router> router);
34
35 // broadcast to all secondary servers the frame data
36 void SendFrameData(carla::Buffer buffer);
37
38 // broadcast to all secondary servers the map to load
39 void SendLoadMap(std::string map);
40
41 // send to know if a connection is alive
42 void SendIsAlive();
43
44 token_type GetToken(stream_id sensor_id);
45
46 void EnableForROS(stream_id sensor_id);
47
48 void DisableForROS(stream_id sensor_id);
49
50 bool IsEnabledForROS(stream_id sensor_id);
51
52 private:
53
54 // send to one secondary to get the token of a sensor
56
57 // manage ROS enable/disable of sensor
58 void SendEnableForROS(stream_id sensor_id);
59 void SendDisableForROS(stream_id sensor_id);
60 bool SendIsEnabledForROS(stream_id sensor_id);
61
62
63 std::shared_ptr<Router> _router;
64 std::unordered_map<stream_id, token_type> _tokens;
65 std::unordered_map<stream_id, std::weak_ptr<Primary>> _servers;
66};
67
68} // namespace multigpu
69} // namespace carla
A piece of raw data.
void SendEnableForROS(stream_id sensor_id)
std::unordered_map< stream_id, token_type > _tokens
void set_router(std::shared_ptr< Router > router)
void DisableForROS(stream_id sensor_id)
bool SendIsEnabledForROS(stream_id sensor_id)
token_type GetToken(stream_id sensor_id)
void SendFrameData(carla::Buffer buffer)
void EnableForROS(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 SendDisableForROS(stream_id sensor_id)
bool IsEnabledForROS(stream_id sensor_id)
std::shared_ptr< Router > _router
Serializes a stream endpoint.
carla::streaming::detail::stream_id_type stream_id
uint32_t stream_id_type
Definition Types.h:18
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133