Hi, I've followed the https://www.yuque.com/xtdrone/manual_en to install XTDrone with PX4 in a fresh Ubuntu 18.04 install, with ROS Melodic.
I had to change the PX4_Firmware references to the new PX4-Autopilot default name in the copy steps (https://www.yuque.com/xtdrone/manual_en/basic_config_1.11#2qN28).
I didn't download the models.zip as it requires a Yuque account, but the manual says it should download them when executing.
PX4 runs Ok with gazebo when running make px4_sitl gazebo but doesn't compile when I copy the modified gazebo_gimbal_controller_plugin.cpp. It throws the next errors:
`
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp: In constructor ‘gazebo::GimbalControllerPlugin::GimbalControllerPlugin()’:
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:102:9: error: ‘class gazebo::GimbalControllerPlugin’ has no member named ‘lastImuYaw’
this->lastImuYaw = 0;
^~~~~~~~~~
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp: In member function ‘virtual void gazebo::GimbalControllerPlugin::Init()’:
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:397:87: error: ‘ImuCallback’ is not a member of ‘gazebo::GimbalControllerPlugin’
imuSub = node->Subscribe("~/" + model->GetName() + "/imu", &GimbalControllerPlugin::ImuCallback, this);
^~~~~~~~~~~
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp: At global scope:
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:402:42: error: variable or field ‘ImuCallback’ declared void
void GimbalControllerPlugin::ImuCallback(ImuPtr& imu_message)
^~~~~~
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:402:42: error: ‘ImuPtr’ was not declared in this scope
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:402:50: error: ‘imu_message’ was not declared in this scope
void GimbalControllerPlugin::ImuCallback(ImuPtr& imu_message)
^~~~~~~~~~~
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp: In member function ‘void gazebo::GimbalControllerPlugin::OnUpdate()’:
/home/foo/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:477:31: error: ‘class gazebo::GimbalControllerPlugin’ has no member named ‘lastImuYaw’
this->yawCommand += this->lastImuYaw;
^~~~~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-address-of-packed-member’
ninja: build stopped: subcommand failed.
FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-build
cd /home/foo/PX4-Autopilot/build/px4_sitl_default/build_gazebo && /usr/bin/cmake --build /home/foo/PX4-Autopilot/build/px4_sitl_default/build_gazebo -- -j2
ninja: build stopped: subcommand failed.
Makefile:217: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Error 1
`
Due to this error I restore the original file and try to execute the custom XTDrone launch files, but I get the following errors.
roslaunch px4 indoor1.launch
...
Warning [parser.cc:950] XML Element[contact], child of element[collision] not defined in SDF. Ignoring[contact]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.
Warning [parser.cc:950] XML Element[bounce], child of element[collision] not defined in SDF. Ignoring[bounce]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.
Warning [parser.cc:950] XML Element[friction], child of element[collision] not defined in SDF. Ignoring[friction]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.
[ INFO] [1607554328.840287734]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1607554328.870219292]: Physics dynamic reconfigure ready.
[INFO] [1607554328.885633, 0.000000]: Loading model XML from file /home/foo/PX4-Autopilot/Tools/sitl_gazebo/models/iris_stereo_camera/iris_stereo_camera.sdf
[INFO] [1607554328.897723, 0.000000]: Waiting for service /gazebo/spawn_sdf_model
[INFO] [1607554328.902918, 0.000000]: Calling service /gazebo/spawn_sdf_model
[INFO] [1607554328.915104, 1814.801000]: Spawn status: SpawnModel: Entity pushed to spawn queue, but spawn service timed out waiting for entity to appear in simulation under the name iris_0
[ERROR] [1607554328.916445, 1814.801000]: Spawn service failed. Exiting.
Warning [parser.cc:950] XML Element[parent], child of element[sensor] not defined in SDF. Ignoring[parent]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.
[vehicle_spawn_foo_4964_5305119535928211108-5] process has died [pid 5020, exit code 1, cmd /opt/ros/melodic/lib/gazebo_ros/spawn_model -sdf -file /home/foo/PX4-Autopilot/Tools/sitl_gazebo/models/iris_stereo_camera/iris_stereo_camera.sdf -model iris_0 -x 0 -y 7.5 -z 1 -R 0 -P 0 -Y 0 __name:=vehicle_spawn_foo_4964_5305119535928211108 __log:=/home/foo/.ros/log/29d1f0a8-3a71-11eb-90cf-5254002085db/vehicle_spawn_foo_4964_5305119535928211108-5.log].
log file: /home/foo/.ros/log/29d1f0a8-3a71-11eb-90cf-5254002085db/vehicle_spawn_foo_4964_5305119535928211108-5*.log
[ INFO] [1607554329.433231180, 1814.869000000]: Camera Plugin: The 'robotNamespace' param was empty
[ INFO] [1607554329.433478758, 1814.869000000]: Camera Plugin: The 'robotNamespace' param was empty
[ INFO] [1607554329.435768017, 1814.869000000]: Camera Plugin (ns = iris_0) <tf_prefix_>, set to "iris_0"
[ INFO] [1607554329.436079956, 1814.869000000]: Camera Plugin (ns = iris_0) <tf_prefix_>, set to "iris_0"
[ WARN] [1607554329.443008672, 1814.869000000]: missing , set to default: /iris_0/
[ INFO] [1607554329.443051924, 1814.869000000]: set to: /iris_0/imu_gazebo
[ INFO] [1607554329.443063386, 1814.869000000]: set to: imu_link_stereo
[ INFO] [1607554329.443088563, 1814.869000000]: set to: 500
[ INFO] [1607554329.443102359, 1814.869000000]: set to: 0
[ INFO] [1607554329.443123179, 1814.869000000]: set to: 0 0 0
[ INFO] [1607554329.443149619, 1814.869000000]: set to: 0 -0 0
Segmentation fault (core dumped)
[gazebo-3] process has died [pid 4994, exit code 139, cmd /opt/ros/melodic/lib/gazebo_ros/gzserver -e ode /home/foo/PX4-Autopilot/Tools/sitl_gazebo/worlds/indoor1.world __name:=gazebo __log:=/home/foo/.ros/log/29d1f0a8-3a71-11eb-90cf-5254002085db/gazebo-3.log].
log file: /home/foo/.ros/log/29d1f0a8-3a71-11eb-90cf-5254002085db/gazebo-3*.log
`
I would like to know if you have any info that can help me solve this errors, thanks!