48 Info <<
"File is not a CARLA recorder" << std::endl;
57 strftime(DateStr,
sizeof(DateStr),
"%x %X", TimeInfo);
58 Info <<
"Date: " << DateStr << std::endl << std::endl;
65 std::stringstream Info;
71 File.open(Filename2, std::ios::binary);
74 Info <<
"File " << Filename2 <<
" not found on server\n";
79 bool bFramePrinted =
false;
82 auto PrintFrame = [
this](std::stringstream &Info)
108 bFramePrinted =
true;
111 bFramePrinted =
false;
116 ReadValue<uint16_t>(
File, Total);
117 if (Total > 0 && !bFramePrinted)
120 bFramePrinted =
true;
122 for (i = 0; i < Total; ++i)
132 Info <<
" " << TCHAR_TO_UTF8(*Att.Id) <<
" = " << TCHAR_TO_UTF8(*Att.Value) << std::endl;
139 ReadValue<uint16_t>(
File, Total);
140 if (Total > 0 && !bFramePrinted)
143 bFramePrinted =
true;
145 for (i = 0; i < Total; ++i)
154 ReadValue<uint16_t>(
File, Total);
155 if (Total > 0 && !bFramePrinted)
158 bFramePrinted =
true;
160 for (i = 0; i < Total; ++i)
170 ReadValue<uint16_t>(
File, Total);
171 if (Total > 0 && !bFramePrinted)
174 bFramePrinted =
true;
176 for (i = 0; i < Total; ++i)
193 ReadValue<uint16_t>(
File, Total);
194 if (Total > 0 && !bFramePrinted)
197 bFramePrinted =
true;
199 Info <<
" Positions: " << Total << std::endl;
200 for (i = 0; i < Total; ++i)
214 ReadValue<uint16_t>(
File, Total);
215 if (Total > 0 && !bFramePrinted)
218 bFramePrinted =
true;
220 Info <<
" State traffic lights: " << Total << std::endl;
221 for (i = 0; i < Total; ++i)
236 ReadValue<uint16_t>(
File, Total);
237 if (Total > 0 && !bFramePrinted)
240 bFramePrinted =
true;
242 Info <<
" Vehicle animations: " << Total << std::endl;
243 for (i = 0; i < Total; ++i)
257 ReadValue<uint16_t>(
File, Total);
258 if (Total > 0 && !bFramePrinted)
261 bFramePrinted =
true;
263 Info <<
" Walker animations: " << Total << std::endl;
264 for (i = 0; i < Total; ++i)
278 ReadValue<uint16_t>(
File, Total);
279 if (Total > 0 && !bFramePrinted)
282 bFramePrinted =
true;
284 Info <<
" Vehicle light animations: " << Total << std::endl;
285 for (i = 0; i < Total; ++i)
291 std::string enabled_lights_list;
293 enabled_lights_list +=
"Position ";
295 enabled_lights_list +=
"LowBeam ";
297 enabled_lights_list +=
"HighBeam ";
299 enabled_lights_list +=
"Brake ";
301 enabled_lights_list +=
"RightBlinker ";
303 enabled_lights_list +=
"LeftBlinker ";
305 enabled_lights_list +=
"Reverse ";
307 enabled_lights_list +=
"Interior ";
309 enabled_lights_list +=
"Fog ";
311 enabled_lights_list +=
"Special1 ";
313 enabled_lights_list +=
"Special2 ";
315 if (enabled_lights_list.size())
318 enabled_lights_list.substr(0, enabled_lights_list.size() - 1) << std::endl;
334 ReadValue<uint16_t>(
File, Total);
335 if (Total > 0 && !bFramePrinted)
338 bFramePrinted =
true;
340 Info <<
" Scene light changes: " << Total << std::endl;
341 for (i = 0; i < Total; ++i)
358 ReadValue<uint16_t>(
File, Total);
359 if (Total > 0 && !bFramePrinted)
362 bFramePrinted =
true;
364 Info <<
" Dynamic actors: " << Total << std::endl;
365 for (i = 0; i < Total; ++i)
370 <<
" angular_velocity: (" 383 ReadValue<uint16_t>(
File, Total);
384 if (Total > 0 && !bFramePrinted)
387 bFramePrinted =
true;
389 Info <<
" Actor bounding boxes: " << Total << std::endl;
390 for (i = 0; i < Total; ++i)
412 ReadValue<uint16_t>(
File, Total);
413 if (Total > 0 && !bFramePrinted)
416 bFramePrinted =
true;
418 Info <<
" Actor trigger volumes: " << Total << std::endl;
419 for (i = 0; i < Total; ++i)
444 bFramePrinted =
true;
457 ReadValue<uint16_t>(
File, Total);
458 if (Total > 0 && !bFramePrinted)
461 bFramePrinted =
true;
464 Info <<
" Physics Control events: " << Total << std::endl;
465 for (i = 0; i < Total; ++i)
470 <<
" max_rpm = " << Control.
max_rpm << std::endl
471 <<
" MOI = " << Control.
moi << std::endl
475 <<
" use_gear_auto_box = " << (Control.
use_gear_autobox ?
"true" :
"false") << std::endl
478 <<
" final_ratio = " << Control.
final_ratio << std::endl
479 <<
" mass = " << Control.
mass << std::endl
482 Info <<
" torque_curve =";
485 Info <<
" (" << vec.x <<
", " << vec.y <<
")";
488 Info <<
" steering_curve =";
491 Info <<
" (" << vec.x <<
", " << vec.y <<
")";
494 Info <<
" forward_gears:" << std::endl;
498 Info <<
" gear " << count <<
": ratio " << Gear.ratio
499 <<
" down_ratio " << Gear.down_ratio
500 <<
" up_ratio " << Gear.up_ratio << std::endl;
503 Info <<
" wheels:" << std::endl;
505 for (
auto& Wheel : Control.
wheels)
507 Info <<
" wheel " << count <<
": tire_friction " << Wheel.tire_friction
508 <<
" damping_rate " << Wheel.damping_rate
509 <<
" max_steer_angle " << Wheel.max_steer_angle
510 <<
" radius " << Wheel.radius
511 <<
" max_brake_torque " << Wheel.max_brake_torque
512 <<
" max_handbrake_torque " << Wheel.max_handbrake_torque
513 <<
" position " <<
"(" << Wheel.position.x <<
", " << Wheel.position.y <<
", " << Wheel.position.z <<
")" 526 ReadValue<uint16_t>(
File, Total);
527 if (Total > 0 && !bFramePrinted)
530 bFramePrinted =
true;
533 Info <<
" Traffic Light time events: " << Total << std::endl;
534 for (i = 0; i < Total; ++i)
551 ReadValue<uint16_t>(
File, Total);
552 if (Total > 0 && !bFramePrinted)
555 bFramePrinted =
true;
558 Info <<
" Walkers Bones: " << Total << std::endl;
559 for (i = 0; i < Total; ++i)
566 Info <<
" Bone: \"" << TCHAR_TO_UTF8(*Bone.Name) <<
"\" relative: " <<
"Loc(" 567 << Bone.Location.X <<
", " << Bone.Location.Y <<
", " << Bone.Location.Z <<
") Rot(" 568 << Bone.Rotation.X <<
", " << Bone.Rotation.Y <<
", " << Bone.Rotation.Z <<
")\n";
588 Info <<
"\nFrames: " <<
Frame.
Id <<
"\n";
598 std::stringstream Info;
604 File.open(Filename2, std::ios::binary);
607 Info <<
"File " << Filename2 <<
" not found on server\n";
615 char Categories[] = {
'o',
'v',
'w',
't',
'h',
'a' };
617 struct ReplayerActorInfo
622 std::unordered_map<uint32_t, ReplayerActorInfo> Actors;
625 std::size_t operator()(
const std::pair<uint32_t, uint32_t>& P)
const 627 std::size_t hash = P.first;
633 std::unordered_set<std::pair<uint32_t, uint32_t>, PairHash > oldCollisions, newCollisions;
636 Info << std::setw(8) <<
"Time";
637 Info <<
" " << std::setw(6) <<
"Types";
638 Info <<
" " << std::setw(6) << std::right <<
"Id";
639 Info <<
" " << std::setw(35) << std::left <<
"Actor 1";
640 Info <<
" " << std::setw(6) << std::right <<
"Id";
641 Info <<
" " << std::setw(35) << std::left <<
"Actor 2";
661 oldCollisions = std::move(newCollisions);
662 newCollisions.clear();
667 ReadValue<uint16_t>(
File, Total);
668 for (i = 0; i < Total; ++i)
678 ReadValue<uint16_t>(
File, Total);
679 for (i = 0; i < Total; ++i)
693 ReadValue<uint16_t>(
File, Total);
694 for (i = 0; i < Total; ++i)
701 uint8_t Type1, Type2;
713 if (Category1 ==
'a')
715 else if (Category1 == Type1)
721 if (Category2 ==
'a')
723 else if (Category2 == Type2)
733 if (oldCollisions.count(collisionPair) == 0)
735 Info << std::setw(8) << std::setprecision(0) << std::right << std::fixed <<
Frame.
Elapsed;
736 Info <<
" " <<
" " << Type1 <<
" " << Type2 <<
" ";
744 newCollisions.insert(collisionPair);
768 Info <<
"\nFrames: " <<
Frame.
Id <<
"\n";
778 std::stringstream Info;
784 File.open(Filename2, std::ios::binary);
787 Info <<
"File " << Filename2 <<
" not found on server\n";
796 struct ReplayerActorInfo
800 FVector LastPosition;
804 std::unordered_map<uint32_t, ReplayerActorInfo> Actors;
806 std::multimap<double, std::string, std::greater<double>> Results;
809 Info << std::setw(8) <<
"Time";
810 Info <<
" " << std::setw(6) <<
"Id";
811 Info <<
" " << std::setw(35) << std::left <<
"Actor";
812 Info <<
" " << std::setw(10) << std::right <<
"Duration";
835 ReadValue<uint16_t>(
File, Total);
836 for (i = 0; i < Total; ++i)
846 ReadValue<uint16_t>(
File, Total);
847 for (i = 0; i < Total; ++i)
867 ReadValue<uint16_t>(
File, Total);
868 for (i=0; i<Total; ++i)
884 std::stringstream Result;
885 Result << std::setw(8) << std::setprecision(0) << std::fixed << Actors[
Position.
DatabaseId].Time;
887 Result <<
" " << std::setw(35) << std::left << TCHAR_TO_UTF8(*Actors[
Position.
DatabaseId].Id);
888 Result <<
" " << std::setw(10) << std::setprecision(0) << std::fixed << std::right << Actors[
Position.
DatabaseId].Duration;
916 for (
auto &
Actor : Actors)
919 if (
Actor.second.Duration >= MinTime)
921 std::stringstream Result;
922 Result << std::setw(8) << std::setprecision(0) << std::fixed <<
Actor.second.Time;
923 Result <<
" " << std::setw(6) <<
Actor.first;
924 Result <<
" " << std::setw(35) << std::left << TCHAR_TO_UTF8(*
Actor.second.Id);
925 Result <<
" " << std::setw(10) << std::setprecision(0) << std::fixed << std::right <<
Actor.second.Duration;
927 Results.insert(std::make_pair(
Actor.second.Duration, Result.str()));
932 for (
auto &Result : Results)
934 Info << Result.second;
937 Info <<
"\nFrames: " <<
Frame.
Id <<
"\n";
CarlaRecorderPosition Position
CarlaRecorderStateTrafficLight StateTraffic
CarlaRecorderBoundingBox BoundingBox
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
bool CheckFileInfo(std::stringstream &Info)
void Read(std::istream &InFile)
CarlaRecorderCollision Collision
CarlaRecorderActorBoundingBox ActorBoundingBox
void Read(std::istream &InFile)
std::string QueryBlocked(std::string Filename, double MinTime=30, double MinDistance=10)
void Read(std::istream &InFile)
std::vector< geom::Vector2D > steering_curve
CarlaRecorderEventDel EventDel
std::string QueryCollisions(std::string Filename, char Category1='a', char Category2='a')
void Read(std::ifstream &InFile)
carla::SharedPtr< cc::Actor > Actor
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &File)
std::string QueryInfo(std::string Filename, bool bShowAll=false)
std::vector< CarlaRecorderActorAttribute > Attributes
std::vector< GearPhysicsControl > forward_gears
float damping_rate_full_throttle
CarlaRecorderWalkerBones WalkerBones
CarlaRecorderEventAdd EventAdd
void Read(std::istream &InFile)
CarlaRecorderKinematics Kinematics
VehicleLightStateType State
CarlaRecorderLightVehicle LightVehicle
CarlaRecorderPhysicsControl PhysicsControl
uint32_t DatabaseIdParent
std::vector< WheelPhysicsControl > wheels
CarlaRecorderInfo RecInfo
CarlaRecorderPlatformTime PlatformTime
CarlaRecorderLightScene LightScene
std::vector< geom::Vector2D > torque_curve
float damping_rate_zero_throttle_clutch_engaged
CarlaRecorderEventParent EventParent
std::string GetRecorderFilename(std::string Filename)
CarlaRecorderAnimVehicle Vehicle
void Read(std::istream &InFile)
float damping_rate_zero_throttle_clutch_disengaged
CarlaRecorderAnimWalker Walker
geom::Location center_of_mass
CarlaRecorderTrafficLightTime TrafficLightTime
Defines the physical appearance of a vehicle whitch is obtained by the sensors.
std::vector< CarlaRecorderWalkerBone > Bones
void Read(std::istream &InFile)
void Read(std::istream &InFile)
FVehiclePhysicsControl VehiclePhysicsControl
void Read(std::istream &InFile)
CarlaRecorderActorDescription Description
void Read(std::istream &InFile)
void Read(std::istream &InFile)