I have a setup where I run a quadcopter in Unreal/ Airsim on a Windows machine and then control and get sensor data from the quadcopter using the MultirotorRpcLibClient from a Linux machine.
I saw that in airsim_ros_wrapper.cpp function AirsimROSWrapper::create_ros_pubs_from_settings_json() settings are pulled from the settings.json file and published as ROS topics.
// If we aren't connected to AirSim, try to connect.
if (!client_connected_) {
cout << "Connecting to AirSim: ip " << airsim_ip_ << ", port " << airsim_port_ << endl;
sim_client_ = std::make_shared<ma::MultirotorRpcLibClient>(airsim_ip_,
airsim_port_,
airsim_timeout_s_);
sim_client_->confirmConnection();
// If we haven't been able to connect to AirSim, warn the user and return.
if (sim_client_->getConnectionState() !=
ma::RpcLibClientBase::ConnectionState::Connected) {
client_connected_ = false;
cout << "Warning: not connected to AirSim." << endl;
// return std::make_shared<sc::MessageBase>();
return true;
}
client_connected_ = true;
sim_client_->enableApiControl(true);
}
// Get Vehicles and Camera Settings
for (const auto& curr_vehicle_elem : AirSimSettings::singleton().vehicles) {
// auto& vehicle_setting = curr_vehicle_elem.second;
// auto curr_vehicle_name = curr_vehicle_elem.vehicle_setting.vehicle_name;
auto& vehicle_setting = curr_vehicle_elem.second;
auto curr_vehicle_name = curr_vehicle_elem.first;
auto vehicle_setting_local = vehicle_setting.get();
cout << "Vehicle Name" << endl;
cout << curr_vehicle_name << endl;
cout << "Vehicle Local" << endl;
cout << vehicle_setting_local->vehicle_name << endl;
//if (curr_vehicle_name=="SimpleFlight") {
for (auto& curr_camera_elem : vehicle_setting_local->cameras) {
auto& camera_setting = curr_camera_elem.second;
auto& curr_camera_name = curr_camera_elem.first;
cout << "Camera Name" << endl;
cout << curr_camera_name << endl;
}
cout << "*************" << endl;
}
Client Ver:1 (Min Req:1), Server Ver:1 (Min Req:1)
Vehicle Name
ComputerVision
Vehicle Local
ComputerVision
*************
Vehicle Name
PhysXCar
Vehicle Local
PhysXCar
*************
Vehicle Name
SimpleFlight
Vehicle Local
SimpleFlight
*************
My settings.json file only has a single quadcopter named "Drone1" with 4 camera settings, however using this method to pull AirSim Settings does not give me the vehicle I expect nor does it see the camera settings at all.
{
"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"LogMessagesVisible": true,
"SpeedUnitFactor": 1.0,
"SpeedUnitLabel": "m/s",
"Recording": {
"RecordOnMove": false,
"RecordInterval": 0.05,
"Cameras": [
{ "CameraID": 0, "ImageType": 0, "PixelsAsFloat": false, "Compress": false },
{ "CameraID": 0, "ImageType": 2, "PixelsAsFloat": true, "Compress": false },
{ "CameraID": 0, "ImageType": 5, "PixelsAsFloat": false, "Compress": false },
{ "CameraID": 0, "ImageType": 7, "PixelsAsFloat": false, "Compress": false }
]
},
"CameraDefaults": {
"CaptureSettings": [
{
"ImageType": 0,
"Width": 256,
"Height": 144,
"FOV_Degrees": 90,
"AutoExposureSpeed": 100,
"AutoExposureBias": 0,
"AutoExposureMaxBrightness": 0.68,
"AutoExposureMinBrightness": 0.03
},
{
"ImageType": 2,
"Width": 256,
"Height": 144,
"FOV_Degrees": 90,
"AutoExposureSpeed": 100,
"AutoExposureBias": 0,
"AutoExposureMaxBrightness": 0.68,
"AutoExposureMinBrightness": 0.03
},
{
"ImageType": 5,
"Width": 256,
"Height": 144,
"FOV_Degrees": 90,
"AutoExposureSpeed": 100,
"AutoExposureBias": 0,
"AutoExposureMaxBrightness": 0.68,
"AutoExposureMinBrightness": 0.03
},
{
"ImageType": 7,
"Width": 256,
"Height": 144,
"FOV_Degrees": 90,
"AutoExposureSpeed": 100,
"AutoExposureBias": 0,
"AutoExposureMaxBrightness": 0.68,
"AutoExposureMinBrightness": 0.03
}
]
},
"Vehicles": {
"Drone1": {
"VehicleType": "simpleflight",
"AutoCreate": true,
"Sensors": {
"Lidar1": {
"SensorType": 6,
"Enabled" : true,
"NumberOfChannels": 16,
"RotationsPerSecond": 10,
"PointsPerSecond": 100000,
"X": 0, "Y": 0, "Z": -1,
"Roll": 0, "Pitch": 0, "Yaw" : 0,
"VerticalFOVUpper": -15,
"VerticalFOVLower": -25,
"HorizontalFOVStart": -20,
"HorizontalFOVEnd": 20,
"DrawDebugPoints": false,
"DataFrame": "SensorLocalFrame"
}
}
}
}
}
Hello,
I have a setup where I run a quadcopter in Unreal/ Airsim on a Windows machine and then control and get sensor data from the quadcopter using the MultirotorRpcLibClient from a Linux machine.
I saw that in airsim_ros_wrapper.cpp function AirsimROSWrapper::create_ros_pubs_from_settings_json() settings are pulled from the settings.json file and published as ROS topics.
I would like to pull my settings from the settings.json file into my logic on the Linux side, however when I use the code block below:
I get the print out:
My settings.json file only has a single quadcopter named "Drone1" with 4 camera settings, however using this method to pull AirSim Settings does not give me the vehicle I expect nor does it see the camera settings at all.
Questions:
Am I using this function wrong?
Is there a way to pull the settings.json file over RPC like the AirsimROSWrapper suggests?
Am I misunderstanding how the AirsimROSWrapper works?
Here is my settings.json: