microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.06k stars 4.48k forks source link

Collecting sensors data from RecordData #4793

Open tanyaspaul opened 1 year ago

tanyaspaul commented 1 year ago

Discussed in https://github.com/microsoft/AirSim/discussions/4784

Originally posted by **tanyaapaul** January 28, 2023 Hello, I was wondering if anyone had tips towards the integregration of the sensors data in the : airsim_rec.txt file. I have tried to implement it by following the instructions from : https://microsoft.github.io/AirSim/modify_recording_data/ However the airsim_rec.txt file still does not integrate the sensors data. I am wondering if anyone has advice or other test suggestion to try to integrate it. Any suggestion would be helpful, Thanks so much --------- Implemented the following based on the documentation but did not work for me: `// MultirotorPawnSimApi.cpp std::string MultirotorPawnSimApi::getRecordFileLine(bool is_header_line) const { std::string common_line = PawnSimApi::getRecordFileLine(is_header_line); if (is_header_line) { return common_line + "Latitude\tLongitude\tAltitude\tPressure\tAccX\tAccY\tAccZ\t"; } const auto& state = vehicle_api_->getMultirotorState(); const auto& bar_data = vehicle_api_->getBarometerData(""); const auto& imu_data = vehicle_api_->getImuData(""); std::ostringstream ss; ss << common_line; ss << state.gps_location.latitude << "\t" << state.gps_location.longitude << "\t" << state.gps_location.altitude << "\t"; ss << bar_data.pressure << "\t"; ss << imu_data.linear_acceleration.x() << "\t" << imu_data.linear_acceleration.y() << "\t" << imu_data.linear_acceleration.z() << "\t"; return ss.str(); }`