|
CARLA
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | ActorAppearance |
| An actor's appearance on the primary that a mirror does not get from its spawn attributes or pose. More... | |
| struct | ActorAppearances |
| Frame data packet 30, on change and on every full resync. More... | |
| struct | BeginFrameState |
| class | BoundedReader |
| Reads the fields of one packet (or one record inside it) without ever consuming more than its declared size. More... | |
| struct | CommandHeader |
| struct | DoorPose |
| An open door, which on the primary is a physics body of its own: its pose relative to the vehicle, in UE units, rotation as a quaternion (x, y, z, w). More... | |
| struct | FrameDataReadResult |
| struct | FrameTime |
| Frame data packet 25: the primary's clocks and episode settings for one frame. More... | |
| struct | GetTokenRequest |
| GET_TOKEN request payload. More... | |
| struct | ImuHistory |
| An IMU's history: its two previous locations (world, cm) and the delta between them; its accelerometer is a second difference over them. More... | |
| class | IncomingMessage |
| Helper for reading incoming TCP messages. More... | |
| class | Listener |
| struct | LoadMapExtras |
| What a LOAD_MAP carries besides the map: for a world the primary generated from OpenDRIVE (generate_opendrive_world), the OpenDRIVE and the generation parameters (rpc::OpendriveGenerationParameters, msgpack). More... | |
| struct | LoadMapRequest |
| struct | MirroredPosition |
| One record of frame data packet 34: an actor's world pose as the primary holds it, in UE units, with its rotation as a quaternion (an Euler round trip snaps pitch near +-90 degrees, e.g. More... | |
| struct | MirroredPositions |
| Frame data packet 34: every live actor's pose in this frame. More... | |
| struct | MirroredVehicleParts |
| Frame data packet 32, every frame: the moving parts of every vehicle. More... | |
| class | Primary |
| A TCP server session. More... | |
| class | PrimaryCommands |
| struct | ReplayedActorPlan |
| class | Router |
| class | Secondary |
| class | SecondaryCommands |
| struct | SensorState |
| One record of frame data packet 27: the runtime state a sensor of the primary starts this frame's tick from. More... | |
| struct | SensorStates |
| Frame data packet 27, for the sensors of packet 26 that carry state. More... | |
| class | SensorStreamRegistry |
| Secondary-side map from a primary sensor actor to its local stream, exposed to clients only through an alias of the primary's stream id. More... | |
| struct | SensorTick |
| One record of frame data packet 26: a sensor of the primary that ticks in this frame, and the delta of that tick. More... | |
| struct | SensorTicks |
| Frame data packet 26: every sensor of the primary that ticks in this frame. More... | |
| struct | SessionInfo |
| Outcome of a routed request. More... | |
| struct | VehicleParts |
| A vehicle's moving parts: every wheel, by wheel index, and the doors open (any other door is closed), and its drivetrain as the primary's simulation has it: what the vehicle's sensors report. More... | |
| struct | WheelPose |
| A wheel as the primary draws it: degrees and cm. More... | |
| struct | WorldGlobals |
| Frame data packet 28, on every frame: world-wide state a client can change on the primary that changes what sensors see or measure. More... | |
| struct | WorldObjects |
| Frame data packet 29, on change and on every full resync: map objects whose state is not part of any actor. More... | |
Typedefs | |
| using | actor_id = uint32_t |
| using | load_map_id_type = uint32_t |
| Identifies one LOAD_MAP broadcast. | |
| using | MirroredActorMap = std::unordered_map< uint32_t, uint32_t > |
| Primary actor id -> id of the local actor a secondary replayed it onto, for the current episode only. | |
| using | stream_id = carla::streaming::detail::stream_id_type |
| using | token_type = carla::streaming::detail::token_type |
Enumerations | |
| enum class | BeginFrameAction { OwnClock , DontWait , Wait } |
| What a secondary does at the start of an engine frame, before the engine computes the frame's time step. More... | |
| enum class | FrameDataStatus : uint8_t { Ok , TruncatedHeader , TruncatedPayload , ShortPacket , ReaderError , MissingFrameCounter , Inconsistent } |
| enum | MultiGPUCommand : uint32_t { SEND_FRAME = 0 , LOAD_MAP , GET_TOKEN , ENABLE_ROS , DISABLE_ROS , IS_ENABLED_ROS , YOU_ALIVE } |
| enum class | PreTickAction { OpenLevel , Play , Skip } |
| What a secondary does when its world starts ticking. More... | |
Functions | |
| std::pair< uint16_t, uint16_t > | ComputeMapLayerDiff (uint16_t current, uint16_t desired) |
| The map layers to load and to unload to go from current to desired. | |
| BeginFrameAction | DecideBeginFrame (const BeginFrameState &state) |
| PreTickAction | DecidePreTick (bool load_map_pending, bool has_episode, bool frame_prepared, bool episode_world) |
| std::pair< std::vector< uint64_t >, std::vector< uint64_t > > | DiffSortedIds (const std::vector< uint64_t > ¤t, const std::vector< uint64_t > &desired) |
| Ids in desired and not in current (first), and the other way round (second). | |
| void | EnableKeepAlive (boost::asio::ip::tcp::socket &socket) |
| Lets either end notice a peer that vanished without closing the connection (a killed host, a cut link): on Linux, after 10 s of silence three probes 5 s apart, so about 25 s. | |
| const char * | FrameDataStatusName (FrameDataStatus status) |
| uint32_t | GetEngineState (const std::minstd_rand &engine) |
| The state of a minstd_rand: the value its next draw is computed from. | |
| bool | IsConsecutive (std::optional< uint64_t > last_played, uint64_t frame) |
| Whether frame directly follows the last frame this secondary played. | |
| bool | IsUsableDelta (float delta_seconds) |
| Whether a primary's delta can be this engine frame's time step. | |
| std::string | MakeEpisodeReadyMessage (load_map_id_type load_id) |
| Episode-ready message: the marker followed by the load id of the LOAD_MAP that started the episode, so the primary can ignore a stale one. | |
| std::string | MakeLoadMapPayload (std::string_view map, load_map_id_type load_id, const LoadMapExtras &extras={}) |
| LOAD_MAP payload: the NUL-terminated map path, the load id, then the extras as [u8 kind][u32 size][bytes] fields; a reader skips the kinds it does not know. | |
| bool | NeedsResync (std::optional< uint64_t > last_played, uint64_t frame, bool full_resync) |
| Whether playing frame shows that this secondary missed primary state (a frame went missing) that only a full resync gives back. | |
| std::vector< uint32_t > | OrderParentsFirst (const std::vector< uint32_t > &ids, const std::unordered_map< uint32_t, uint32_t > &parents) |
| Order in which to place actors so that every parent is placed before its children: by attachment depth, keeping the input order within a depth. | |
| std::optional< load_map_id_type > | ParseEpisodeReadyMessage (std::string_view payload) |
| Load id of an episode-ready message (0 for a bare marker), or nullopt if payload is not one. | |
| LoadMapRequest | ParseLoadMapPayload (std::string_view payload) |
| template<typename LocalActors > | |
| ReplayedActorPlan | PlanReplayedActor (const MirroredActorMap &mirrors, uint32_t primary_id, const LocalActors &local) |
| Where a secondary replays the add event of primary actor primary_id. | |
| template<typename ReadPacket > | |
| FrameDataReadResult | ReadFrameData (const uint8_t *data, std::size_t size, ReadPacket &&read_packet) |
| Walks the packets of one frame. | |
| bool | SetEngineState (std::minstd_rand &engine, uint32_t state) |
| Makes engine continue from state, as GetEngineState returned it. | |
| void | WriteField (std::ostream &out, uint8_t kind, const std::string &value) |
| void | WriteFixedListHeader (std::ostream &out, uint32_t count, uint16_t record_size) |
| Header of a list of fixed-size records. | |
| void | WriteFrameDataHeader (std::ostream &out, uint8_t id, uint32_t payload_size) |
| void | WriteFrameDataPacket (std::ostream &out, uint8_t id, const std::string &payload) |
| Writes a packet whose payload was built beforehand. | |
| void | WriteSizedBytes (std::ostream &out, const std::string &bytes) |
| One [u32 size][bytes] entry: a variable-size record or, after a kind byte, a TLV value. | |
Variables | |
| constexpr std::string_view | kEpisodeReadyMarker {"EPISODE_READY"} |
| Sent unprompted by a secondary, on the same channel as command responses, to signal that its episode is ready to receive frames (see Router::HandleResponse). | |
| constexpr uint8_t | kFrameCounterPacketId = 18u |
| Id of the frame counter packet, the last packet of every complete frame. | |
| constexpr std::size_t | kFrameDataHeaderSize = 5u |
| Frame data (the SEND_FRAME payload) is a sequence of packets [uint8 id][uint32 payload size][payload] in host byte order. | |
| constexpr std::size_t | kMaxMultiGpuMessageBytes = (std::size_t{1u} << 30u) + (std::size_t{1u} << 20u) |
| Largest message either end accepts: a frame (capped at 1 GiB by the primary) plus room for its headers. | |
| constexpr uint8_t | kMultiGpuProtocolVersion = 1u |
| Version of the whole Multi-GPU wire format, carried in every frame. | |
| constexpr std::string_view | kTokenNotReadyMarker {"TOKEN_NOT_READY"} |
| GET_TOKEN reply when the secondary cannot resolve the sensor to a stream (or the request is malformed). | |
| static std::atomic_size_t | SESSION_COUNTER {0u} |
| using carla::multigpu::actor_id = typedef uint32_t |
Definition at line 28 of file primaryCommands.h.
| using carla::multigpu::load_map_id_type = typedef uint32_t |
Identifies one LOAD_MAP broadcast.
Assigned by the primary starting at 1; 0 means the episode was not started by a LOAD_MAP.
Definition at line 46 of file commands.h.
| using carla::multigpu::MirroredActorMap = typedef std::unordered_map<uint32_t, uint32_t> |
Primary actor id -> id of the local actor a secondary replayed it onto, for the current episode only.
Definition at line 16 of file mirroredActors.h.
| using carla::multigpu::stream_id = typedef carla::streaming::detail::stream_id_type |
Definition at line 27 of file primaryCommands.h.
| using carla::multigpu::token_type = typedef carla::streaming::detail::token_type |
Definition at line 26 of file primaryCommands.h.
|
strong |
What a secondary does at the start of an engine frame, before the engine computes the frame's time step.
Definition at line 16 of file frameGate.h.
|
strong |
| Enumerator | |
|---|---|
| Ok | |
| TruncatedHeader | |
| TruncatedPayload | |
| ShortPacket | |
| ReaderError | |
| MissingFrameCounter | |
| Inconsistent | Packets that contradict each other (set by the reader's owner, e.g. a FrameTime for another frame than the FrameCounter). |
Definition at line 34 of file frameDataCodec.h.
| enum carla::multigpu::MultiGPUCommand : uint32_t |
| Enumerator | |
|---|---|
| SEND_FRAME | |
| LOAD_MAP | |
| GET_TOKEN | |
| ENABLE_ROS | |
| DISABLE_ROS | |
| IS_ENABLED_ROS | |
| YOU_ALIVE | |
Definition at line 19 of file commands.h.
|
strong |
What a secondary does when its world starts ticking.
Definition at line 45 of file frameGate.h.
|
inline |
The map layers to load and to unload to go from current to desired.
Definition at line 230 of file worldState.h.
References ComputeMapLayerDiff().
Referenced by ComputeMapLayerDiff(), and FFrameData::PlayMapLayers().
|
inline |
Definition at line 34 of file frameGate.h.
References carla::multigpu::BeginFrameState::connected, DecideBeginFrame(), DontWait, carla::multigpu::BeginFrameState::exit_requested, carla::multigpu::BeginFrameState::has_episode, carla::multigpu::BeginFrameState::load_map_pending, OwnClock, carla::multigpu::BeginFrameState::travel_pending, and Wait.
Referenced by DecideBeginFrame(), and FCarlaEngine::OnBeginFrame().
|
inline |
Definition at line 54 of file frameGate.h.
References DecidePreTick(), OpenLevel, Play, and Skip.
Referenced by DecidePreTick(), and FCarlaEngine::OnPreTick().
|
inline |
Ids in desired and not in current (first), and the other way round (second).
Both inputs sorted.
Definition at line 236 of file worldState.h.
References DiffSortedIds().
Referenced by DiffSortedIds(), and FFrameData::PlayWorldState().
|
inline |
Lets either end notice a peer that vanished without closing the connection (a killed host, a cut link): on Linux, after 10 s of silence three probes 5 s apart, so about 25 s.
Definition at line 21 of file keepAlive.h.
Referenced by carla::multigpu::Secondary::Connect(), and carla::multigpu::Primary::Open().
|
inline |
Definition at line 46 of file frameDataCodec.h.
References Inconsistent, MissingFrameCounter, Ok, ReaderError, ShortPacket, TruncatedHeader, and TruncatedPayload.
Referenced by FCarlaEngine::NotifyInitGame(), and FCarlaEngine::OnPostTick().
|
inline |
The state of a minstd_rand: the value its next draw is computed from.
Definition at line 254 of file sensorSync.h.
References GetEngineState().
Referenced by GetEngineState(), and URandomEngine::GetState().
|
inline |
Whether frame directly follows the last frame this secondary played.
Definition at line 69 of file frameGate.h.
References IsConsecutive().
Referenced by IsConsecutive(), NeedsResync(), and FCarlaEngine::PlayPrimaryFrame().
|
inline |
Whether a primary's delta can be this engine frame's time step.
Definition at line 80 of file frameGate.h.
References IsUsableDelta().
Referenced by IsUsableDelta(), and FCarlaEngine::OnBeginFrame().
|
inline |
Episode-ready message: the marker followed by the load id of the LOAD_MAP that started the episode, so the primary can ignore a stale one.
Definition at line 124 of file commands.h.
References kEpisodeReadyMarker.
Referenced by FCarlaEngine::SendEpisodeReady(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
LOAD_MAP payload: the NUL-terminated map path, the load id, then the extras as [u8 kind][u32 size][bytes] fields; a reader skips the kinds it does not know.
Definition at line 63 of file commands.h.
Referenced by carla::multigpu::Router::SendLoadMap(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Whether playing frame shows that this secondary missed primary state (a frame went missing) that only a full resync gives back.
Definition at line 75 of file frameGate.h.
References IsConsecutive(), and NeedsResync().
Referenced by NeedsResync(), and FCarlaEngine::PlayPrimaryFrame().
|
inline |
Order in which to place actors so that every parent is placed before its children: by attachment depth, keeping the input order within a depth.
parents maps an id to its parent's id (absent or 0 for a root). A parent that is not among ids counts as a root, and so does every actor of a cycle, so the result always holds every id once.
Definition at line 257 of file mirrorPackets.h.
References OrderParentsFirst().
Referenced by OrderParentsFirst(), and FFrameData::PlayPositions().
|
inline |
Load id of an episode-ready message (0 for a bare marker), or nullopt if payload is not one.
Definition at line 132 of file commands.h.
References kEpisodeReadyMarker.
Referenced by carla::multigpu::Router::HandleResponse(), and TEST().
|
inline |
Definition at line 90 of file commands.h.
References carla::multigpu::LoadMapRequest::extras, carla::multigpu::LoadMapExtras::generation_parameters, carla::multigpu::LoadMapRequest::load_id, carla::multigpu::LoadMapRequest::map, and carla::multigpu::LoadMapExtras::opendrive.
Referenced by FCarlaEngine::NotifyInitGame(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().
| ReplayedActorPlan carla::multigpu::PlanReplayedActor | ( | const MirroredActorMap & | mirrors, |
| uint32_t | primary_id, | ||
| const LocalActors & | local | ||
| ) |
Where a secondary replays the add event of primary actor primary_id.
Local ids follow the secondary's own counter, so a local actor whose id equals primary_id may be another actor, and is only reused if it is a map actor that mirrors no other primary actor. local provides: bool IsSameKind(id): the local actor exists with the replayed blueprint. std::optional<uint32_t> FindMapActor(): the map-registered local actor that is the replayed one (the spectator, a prop at its place), if any. bool IsMapActorLike(id): a map-registered local actor matching the replayed description. bool Contains(id): the id is taken, dormant actors included.
Definition at line 36 of file mirroredActors.h.
Referenced by FFrameData::CreateOrReuseActor().
| FrameDataReadResult carla::multigpu::ReadFrameData | ( | const uint8_t * | data, |
| std::size_t | size, | ||
| ReadPacket && | read_packet | ||
| ) |
Walks the packets of one frame.
read_packet(id, payload, size) reads a known packet from payload, a stream that ends where the packet ends, and returns true; for an id it does not know it returns false without reading. The loop always moves on by the declared size, so unknown packets, packets that grew in a newer build and empty packets are skipped, and it never reads outside [data, data + size).
Definition at line 130 of file frameDataCodec.h.
References carla::multigpu::FrameDataReadResult::first_skipped_id, carla::multigpu::FrameDataReadResult::frame, carla::multigpu::FrameDataReadResult::grown, kFrameCounterPacketId, kFrameDataHeaderSize, MissingFrameCounter, carla::multigpu::FrameDataReadResult::offset, carla::multigpu::FrameDataReadResult::packet_id, carla::multigpu::FrameDataReadResult::packet_size, ReaderError, ReadFrameData(), carla::multigpu::detail::ReadPod(), carla::multigpu::detail::PayloadBuffer::Remaining(), ShortPacket, carla::multigpu::FrameDataReadResult::skipped, carla::multigpu::FrameDataReadResult::status, TruncatedHeader, and TruncatedPayload.
Referenced by FFrameData::Read(), and ReadFrameData().
|
inline |
Makes engine continue from state, as GetEngineState returned it.
False for a value no minstd_rand can hold.
Definition at line 264 of file sensorSync.h.
References SetEngineState().
Referenced by SetEngineState(), and URandomEngine::SetState().
|
inline |
Definition at line 342 of file frameDataCodec.h.
References carla::multigpu::detail::WritePod(), and WriteSizedBytes().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), carla::multigpu::MirroredVehicleParts::Write(), carla::multigpu::SensorStates::Write(), carla::multigpu::WorldObjects::Write(), and carla::multigpu::ActorAppearances::Write().
|
inline |
Header of a list of fixed-size records.
Definition at line 330 of file frameDataCodec.h.
References carla::multigpu::detail::WritePod().
Referenced by carla::multigpu::MirroredPositions::Write(), carla::multigpu::MirroredVehicleParts::Write(), and carla::multigpu::SensorTicks::Write().
|
inline |
Definition at line 112 of file frameDataCodec.h.
References WriteFrameDataHeader(), and carla::multigpu::detail::WritePod().
Referenced by carla::multigpu::FrameTime::Write(), carla::multigpu::MirroredPositions::Write(), carla::multigpu::SensorTicks::Write(), carla::multigpu::WorldGlobals::Write(), WriteFrameDataHeader(), and WriteFrameDataPacket().
|
inline |
Writes a packet whose payload was built beforehand.
Definition at line 118 of file frameDataCodec.h.
References WriteFrameDataHeader().
Referenced by carla::multigpu::MirroredVehicleParts::Write(), carla::multigpu::SensorStates::Write(), carla::multigpu::WorldObjects::Write(), and carla::multigpu::ActorAppearances::Write().
|
inline |
One [u32 size][bytes] entry: a variable-size record or, after a kind byte, a TLV value.
Definition at line 337 of file frameDataCodec.h.
References carla::multigpu::detail::WritePod().
Referenced by TEST(), TEST(), carla::multigpu::MirroredVehicleParts::Write(), carla::multigpu::SensorStates::Write(), carla::multigpu::ActorAppearances::Write(), and WriteField().
|
inlineconstexpr |
Sent unprompted by a secondary, on the same channel as command responses, to signal that its episode is ready to receive frames (see Router::HandleResponse).
No command reply may ever start with this value.
Definition at line 42 of file commands.h.
Referenced by MakeEpisodeReadyMessage(), ParseEpisodeReadyMessage(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
constexpr |
Id of the frame counter packet, the last packet of every complete frame.
Definition at line 28 of file frameDataCodec.h.
Referenced by ReadFrameData().
|
constexpr |
Frame data (the SEND_FRAME payload) is a sequence of packets [uint8 id][uint32 payload size][payload] in host byte order.
Every server runs the same build, so nothing is byte swapped.
Definition at line 25 of file frameDataCodec.h.
Referenced by ReadFrameData(), TEST(), TEST(), TEST(), and TEST().
|
inlineconstexpr |
Largest message either end accepts: a frame (capped at 1 GiB by the primary) plus room for its headers.
A larger size prefix can only be a corrupt stream, so the session is closed instead of allocating it.
Definition at line 37 of file commands.h.
Referenced by carla::multigpu::Primary::ReadData(), carla::multigpu::Secondary::ReadData(), TEST(), and TEST().
|
constexpr |
Version of the whole Multi-GPU wire format, carried in every frame.
It is only reported: readers skip what they do not know instead of rejecting it.
Definition at line 32 of file frameDataCodec.h.
Referenced by TEST().
|
inlineconstexpr |
GET_TOKEN reply when the secondary cannot resolve the sensor to a stream (or the request is malformed).
Shorter than a token on purpose.
Definition at line 159 of file commands.h.
Referenced by FCarlaEngine::NotifyInitGame(), carla::multigpu::PrimaryCommands::SendGetToken(), TEST(), TEST_F(), and TEST_F().
|
static |
Definition at line 28 of file primary.cpp.