33 if (walkers->empty()) {
38 std::shared_ptr<const EpisodeState> state = episode->GetState();
51 std::vector<Cmd> commands;
52 commands.reserve(walkers->size());
53 for (
auto handle : *walkers) {
57 commands.emplace_back(Cmd::ApplyWalkerState{ handle.walker, trans, speed });
77 UnregisterWalker(walkers[_next_check_index].walker, walkers[_next_check_index].controller);
86 std::vector<carla::nav::VehicleCollisionInfo> vehicles;
89 std::shared_ptr<const EpisodeState> state = episode->GetState();
92 for (
auto &&actor : episode->GetActors()) {
94 if (actor.description.id.rfind(
"vehicle.", 0) == 0) {
110 for (
int i = 0; i <
_nav.
GetCrowd()->getAgentCount(); ++i) {
112 const dtCrowdAgent *agent =
_nav.
GetCrowd()->getAgent(i);
113 if (agent && agent->params.useObb) {
116 p1.
x = agent->params.obb[0];
117 p1.
z = agent->params.obb[1];
118 p1.
y = agent->params.obb[2];
119 p2.
x = agent->params.obb[3];
120 p2.
z = agent->params.obb[4];
121 p2.
y = agent->params.obb[5];
122 p3.
x = agent->params.obb[6];
123 p3.
z = agent->params.obb[7];
124 p3.
y = agent->params.obb[8];
125 p4.
x = agent->params.obb[9];
126 p4.
z = agent->params.obb[10];
127 p4.
y = agent->params.obb[11];
133 line1.
color = { 0, 255, 0 };
137 line1.
color = { 255, 0, 0 };
141 line1.
color = { 0, 0, 255 };
145 line1.
color = { 255, 255, 0 };
151 for (
int i = 0; i <
_nav.
GetCrowd()->getAgentCount(); ++i) {
153 const dtCrowdAgent *agent =
_nav.
GetCrowd()->getAgent(i);
157 if (agent->params.userData) {
158 std::ostringstream out;
159 out << *(reinterpret_cast<const float *>(agent->params.userData));
164 text.
color = { 0, 255, 0 };
void CheckIfWalkerExist(std::vector< WalkerHandle > walkers, const EpisodeState &state)
check a few walkers and if they don't exist then remove from the crowd
bool RemoveAgent(ActorId id)
remove an agent
std::vector< uint8_t > GetCacheFile(const std::string &name, const bool request_otherwise=true) const
unsigned long _next_check_index
This file contains definitions of common data structures used in traffic manager. ...
std::vector< std::string > GetRequiredFiles(const std::string &folder="", const bool download=true) const
void DrawDebugShape(const rpc::DebugShape &shape)
AtomicList< WalkerHandle > _walkers
Represents the state of all the actors of an episode at a given frame.
carla::nav::Navigation _nav
bool ContainsActorSnapshot(ActorId actor_id) const
void UpdateVehiclesInCrowd(std::shared_ptr< Episode > episode, bool show_debug=false)
add/update/delete all vehicles in crowd
void ApplyBatch(std::vector< rpc::Command > commands, bool do_tick_cue)
WalkerNavigation(Client &client)
void UpdateCrowd(const client::detail::EpisodeState &state)
update all walkers in crowd
Provides communication with the rpc and streaming servers of a CARLA simulator.
geom::Transform transform
void Tick(std::shared_ptr< Episode > episode)
bool GetWalkerTransform(ActorId id, carla::geom::Transform &trans)
get the walker current transform
void UnregisterWalker(ActorId walker_id, ActorId controller_id)
float GetWalkerSpeed(ActorId id)
get the walker current transform
bool DestroyActor(rpc::ActorId actor)
struct to send info about vehicles to the crowd
boost::variant2::variant< Point, Line, Arrow, Box, String > primitive
bool Load(const std::string &filename)
load navigation data
bool UpdateVehicles(std::vector< VehicleCollisionInfo > vehicles)
add/update/delete vehicles in crowd