You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
// 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;
}
I get the print out:
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.
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?
Function create_ros_pubs_from_settings_json() (although named so) takes all the information not from json file, but from AirSimSettings singleton. Thus, you have to initialize AirSimSettingsParser class before using create_ros_pubs_from_settings_json(). This will run AirSimSettingsParser's constructor, parse settings.json and fill AirSimSettings.
In other words, what you are doing is ok, just put AirSimSettingsParser somewhere in the definition of your node class.
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:
The text was updated successfully, but these errors were encountered: