50 Info <<
"File is not a CARLA recorder" << std::endl;
59 strftime(DateStr,
sizeof(DateStr),
"%x %X", TimeInfo);
60 Info <<
"Date: " << DateStr << std::endl << std::endl;
67 std::stringstream Info;
73 File.open(Filename2, std::ios::binary);
76 Info <<
"File " << Filename2 <<
" not found on server\n";
81 bool bFramePrinted =
false;
84 auto PrintFrame = [
this](std::stringstream &Info)
110 bFramePrinted =
true;
113 bFramePrinted =
false;
118 ReadValue<uint16_t>(
File, Total);
119 if (Total > 0 && !bFramePrinted)
122 bFramePrinted =
true;
124 for (i = 0; i < Total; ++i)
134 Info <<
" " << TCHAR_TO_UTF8(*Att.Id) <<
" = " << TCHAR_TO_UTF8(*Att.Value) << std::endl;
141 ReadValue<uint16_t>(
File, Total);
142 if (Total > 0 && !bFramePrinted)
145 bFramePrinted =
true;
147 for (i = 0; i < Total; ++i)
156 ReadValue<uint16_t>(
File, Total);
157 if (Total > 0 && !bFramePrinted)
160 bFramePrinted =
true;
162 for (i = 0; i < Total; ++i)
172 ReadValue<uint16_t>(
File, Total);
173 if (Total > 0 && !bFramePrinted)
176 bFramePrinted =
true;
178 for (i = 0; i < Total; ++i)
195 ReadValue<uint16_t>(
File, Total);
196 if (Total > 0 && !bFramePrinted)
199 bFramePrinted =
true;
201 Info <<
" Positions: " << Total << std::endl;
202 for (i = 0; i < Total; ++i)
216 ReadValue<uint16_t>(
File, Total);
217 if (Total > 0 && !bFramePrinted)
220 bFramePrinted =
true;
222 Info <<
" State traffic lights: " << Total << std::endl;
223 for (i = 0; i < Total; ++i)
238 ReadValue<uint16_t>(
File, Total);
239 if (Total > 0 && !bFramePrinted)
242 bFramePrinted =
true;
244 Info <<
" Vehicle animations: " << Total << std::endl;
245 for (i = 0; i < Total; ++i)
259 ReadValue<uint16_t>(
File, Total);
260 if (Total > 0 && !bFramePrinted)
263 bFramePrinted =
true;
265 Info <<
" Walker animations: " << Total << std::endl;
266 for (i = 0; i < Total; ++i)
280 ReadValue<uint16_t>(
File, Total);
281 if (Total > 0 && !bFramePrinted)
284 bFramePrinted =
true;
286 Info <<
" Vehicle door animations: " << Total << std::endl;
287 for (i = 0; i < Total; ++i)
294 std::string opened_doors_list;
297 Info <<
" Doors opened: ";
299 Info <<
" Front Left " << std::endl;
301 Info <<
" Front Right " << std::endl;
303 Info <<
" Rear Left " << std::endl;
305 Info <<
" Rear Right " << std::endl;
307 Info <<
" Hood " << std::endl;
309 Info <<
" Trunk " << std::endl;
311 Info <<
" All " << std::endl;
323 ReadValue<uint16_t>(
File, Total);
324 if (Total > 0 && !bFramePrinted)
327 bFramePrinted =
true;
329 Info <<
" Vehicle light animations: " << Total << std::endl;
330 for (i = 0; i < Total; ++i)
336 std::string enabled_lights_list;
338 enabled_lights_list +=
"Position ";
340 enabled_lights_list +=
"LowBeam ";
342 enabled_lights_list +=
"HighBeam ";
344 enabled_lights_list +=
"Brake ";
345 if (
State.RightBlinker)
346 enabled_lights_list +=
"RightBlinker ";
347 if (
State.LeftBlinker)
348 enabled_lights_list +=
"LeftBlinker ";
350 enabled_lights_list +=
"Reverse ";
352 enabled_lights_list +=
"Interior ";
354 enabled_lights_list +=
"Fog ";
356 enabled_lights_list +=
"Special1 ";
358 enabled_lights_list +=
"Special2 ";
360 if (enabled_lights_list.size())
363 enabled_lights_list.substr(0, enabled_lights_list.size() - 1) << std::endl;
379 ReadValue<uint16_t>(
File, Total);
380 if (Total > 0 && !bFramePrinted)
383 bFramePrinted =
true;
385 Info <<
" Scene light changes: " << Total << std::endl;
386 for (i = 0; i < Total; ++i)
403 ReadValue<uint16_t>(
File, Total);
404 if (Total > 0 && !bFramePrinted)
407 bFramePrinted =
true;
409 Info <<
" Dynamic actors: " << Total << std::endl;
410 for (i = 0; i < Total; ++i)
415 <<
" angular_velocity: ("
428 ReadValue<uint16_t>(
File, Total);
429 if (Total > 0 && !bFramePrinted)
432 bFramePrinted =
true;
434 Info <<
" Actor bounding boxes: " << Total << std::endl;
435 for (i = 0; i < Total; ++i)
457 ReadValue<uint16_t>(
File, Total);
458 if (Total > 0 && !bFramePrinted)
461 bFramePrinted =
true;
463 Info <<
" Actor trigger volumes: " << Total << std::endl;
464 for (i = 0; i < Total; ++i)
489 bFramePrinted =
true;
502 ReadValue<uint16_t>(
File, Total);
503 if (Total > 0 && !bFramePrinted)
506 bFramePrinted =
true;
509 Info <<
" Physics Control events: " << Total << std::endl;
510 for (i = 0; i < Total; ++i)
515 <<
" max_rpm = " << Control.
max_rpm << std::endl
516 <<
" MOI = " << Control.
moi << std::endl
520 <<
" use_gear_auto_box = " << (Control.
use_gear_autobox ?
"true" :
"false") << std::endl
523 <<
" final_ratio = " << Control.
final_ratio << std::endl
524 <<
" mass = " << Control.
mass << std::endl
527 Info <<
" torque_curve =";
530 Info <<
" (" << vec.x <<
", " << vec.y <<
")";
533 Info <<
" steering_curve =";
536 Info <<
" (" << vec.x <<
", " << vec.y <<
")";
539 Info <<
" forward_gears:" << std::endl;
543 Info <<
" gear " << count <<
": ratio " << Gear.ratio
544 <<
" down_ratio " << Gear.down_ratio
545 <<
" up_ratio " << Gear.up_ratio << std::endl;
548 Info <<
" wheels:" << std::endl;
550 for (
auto& Wheel : Control.
wheels)
552 Info <<
" wheel " << count <<
": tire_friction " << Wheel.tire_friction
553 <<
" damping_rate " << Wheel.damping_rate
554 <<
" max_steer_angle " << Wheel.max_steer_angle
555 <<
" radius " << Wheel.radius
556 <<
" max_brake_torque " << Wheel.max_brake_torque
557 <<
" max_handbrake_torque " << Wheel.max_handbrake_torque
558 <<
" position " <<
"(" << Wheel.position.x <<
", " << Wheel.position.y <<
", " << Wheel.position.z <<
")"
571 ReadValue<uint16_t>(
File, Total);
572 if (Total > 0 && !bFramePrinted)
575 bFramePrinted =
true;
578 Info <<
" Traffic Light time events: " << Total << std::endl;
579 for (i = 0; i < Total; ++i)
596 ReadValue<uint16_t>(
File, Total);
597 if (Total > 0 && !bFramePrinted)
600 bFramePrinted =
true;
603 Info <<
" Walkers Bones: " << Total << std::endl;
604 for (i = 0; i < Total; ++i)
611 Info <<
" Bone: \"" << TCHAR_TO_UTF8(*Bone.Name) <<
"\" relative: " <<
"Loc("
612 << Bone.Location.X <<
", " << Bone.Location.Y <<
", " << Bone.Location.Z <<
") Rot("
613 << Bone.Rotation.X <<
", " << Bone.Rotation.Y <<
", " << Bone.Rotation.Z <<
")\n";
633 Info <<
"\nFrames: " <<
Frame.
Id <<
"\n";
643 std::stringstream Info;
649 File.open(Filename2, std::ios::binary);
652 Info <<
"File " << Filename2 <<
" not found on server\n";
660 char Categories[] = {
'o',
'v',
'w',
't',
'h',
'a' };
662 struct ReplayerActorInfo
667 std::unordered_map<uint32_t, ReplayerActorInfo> Actors;
670 std::size_t operator()(
const std::pair<uint32_t, uint32_t>& P)
const
672 std::size_t hash = P.first;
678 std::unordered_set<std::pair<uint32_t, uint32_t>, PairHash > oldCollisions, newCollisions;
681 Info << std::setw(8) <<
"Time";
682 Info <<
" " << std::setw(6) <<
"Types";
683 Info <<
" " << std::setw(6) << std::right <<
"Id";
684 Info <<
" " << std::setw(35) << std::left <<
"Actor 1";
685 Info <<
" " << std::setw(6) << std::right <<
"Id";
686 Info <<
" " << std::setw(35) << std::left <<
"Actor 2";
706 oldCollisions = std::move(newCollisions);
707 newCollisions.clear();
712 ReadValue<uint16_t>(
File, Total);
713 for (i = 0; i < Total; ++i)
723 ReadValue<uint16_t>(
File, Total);
724 for (i = 0; i < Total; ++i)
738 ReadValue<uint16_t>(
File, Total);
739 for (i = 0; i < Total; ++i)
746 uint8_t Type1, Type2;
758 if (Category1 ==
'a')
760 else if (Category1 == Type1)
766 if (Category2 ==
'a')
768 else if (Category2 == Type2)
778 if (oldCollisions.count(collisionPair) == 0)
780 Info << std::setw(8) << std::setprecision(0) << std::right << std::fixed <<
Frame.
Elapsed;
781 Info <<
" " <<
" " << Type1 <<
" " << Type2 <<
" ";
789 newCollisions.insert(collisionPair);
813 Info <<
"\nFrames: " <<
Frame.
Id <<
"\n";
823 std::stringstream Info;
829 File.open(Filename2, std::ios::binary);
832 Info <<
"File " << Filename2 <<
" not found on server\n";
841 struct ReplayerActorInfo
845 FVector LastPosition;
849 std::unordered_map<uint32_t, ReplayerActorInfo> Actors;
851 std::multimap<double, std::string, std::greater<double>> Results;
854 Info << std::setw(8) <<
"Time";
855 Info <<
" " << std::setw(6) <<
"Id";
856 Info <<
" " << std::setw(35) << std::left <<
"Actor";
857 Info <<
" " << std::setw(10) << std::right <<
"Duration";
880 ReadValue<uint16_t>(
File, Total);
881 for (i = 0; i < Total; ++i)
891 ReadValue<uint16_t>(
File, Total);
892 for (i = 0; i < Total; ++i)
912 ReadValue<uint16_t>(
File, Total);
913 for (i=0; i<Total; ++i)
929 std::stringstream Result;
930 Result << std::setw(8) << std::setprecision(0) << std::fixed << Actors[
Position.
DatabaseId].Time;
932 Result <<
" " << std::setw(35) << std::left << TCHAR_TO_UTF8(*Actors[
Position.
DatabaseId].Id);
933 Result <<
" " << std::setw(10) << std::setprecision(0) << std::fixed << std::right << Actors[
Position.
DatabaseId].Duration;
961 for (
auto &Actor : Actors)
964 if (Actor.second.Duration >= MinTime)
966 std::stringstream Result;
967 Result << std::setw(8) << std::setprecision(0) << std::fixed << Actor.second.Time;
968 Result <<
" " << std::setw(6) << Actor.first;
969 Result <<
" " << std::setw(35) << std::left << TCHAR_TO_UTF8(*Actor.second.Id);
970 Result <<
" " << std::setw(10) << std::setprecision(0) << std::fixed << std::right << Actor.second.Duration;
972 Results.insert(std::make_pair(Actor.second.Duration, Result.str()));
977 for (
auto &Result : Results)
979 Info << Result.second;
982 Info <<
"\nFrames: " <<
Frame.
Id <<
"\n";
std::string GetRecorderFilename(std::string Filename)
EVehicleDoor
Type of door to open/close
CarlaRecorderCollision Collision
CarlaRecorderAnimWalker Walker
CarlaRecorderEventParent EventParent
CarlaRecorderActorBoundingBox ActorBoundingBox
CarlaRecorderEventDel EventDel
CarlaRecorderDoorVehicle DoorVehicle
CarlaRecorderLightVehicle LightVehicle
CarlaRecorderStateTrafficLight StateTraffic
CarlaRecorderPhysicsControl PhysicsControl
bool CheckFileInfo(std::stringstream &Info)
CarlaRecorderLightScene LightScene
std::string QueryBlocked(std::string Filename, double MinTime=30, double MinDistance=10)
std::string QueryCollisions(std::string Filename, char Category1='a', char Category2='a')
CarlaRecorderWalkerBones WalkerBones
CarlaRecorderKinematics Kinematics
CarlaRecorderAnimVehicle Vehicle
CarlaRecorderEventAdd EventAdd
CarlaRecorderPlatformTime PlatformTime
CarlaRecorderTrafficLightTime TrafficLightTime
CarlaRecorderPosition Position
CarlaRecorderInfo RecInfo
std::string QueryInfo(std::string Filename, bool bShowAll=false)
Defines the physical appearance of a vehicle whitch is obtained by the sensors.
std::vector< geom::Vector2D > steering_curve
float damping_rate_zero_throttle_clutch_disengaged
std::vector< WheelPhysicsControl > wheels
float damping_rate_full_throttle
float damping_rate_zero_throttle_clutch_engaged
std::vector< GearPhysicsControl > forward_gears
std::vector< geom::Vector2D > torque_curve
geom::Location center_of_mass
CarlaRecorderBoundingBox BoundingBox
void Read(std::istream &InFile)
std::vector< CarlaRecorderActorAttribute > Attributes
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
CarlaRecorderActorDescription Description
void Read(std::istream &InFile)
uint32_t DatabaseIdParent
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &File)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
VehicleLightStateType State
void Read(std::istream &InFile)
void Read(std::istream &InFile)
FVehiclePhysicsControl VehiclePhysicsControl
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::ifstream &InFile)
std::vector< CarlaRecorderWalkerBone > Bones