Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gazebo exited with undefined symbol error: _ZN8mav_msgs4msgs10MotorSpeedC1Ev #12810

Closed
lguanrui opened this issue Aug 26, 2019 · 17 comments
Closed
Labels
Admin: More Information Needed Sim: SITL software in the loop simulation

Comments

@lguanrui
Copy link

Problem
When I tried to launch the posix_sitl.launch, the gazebo exited with the error message shown below.
Screenshot of the error message
Screenshot from 2019-08-26 12-11-45
I'm wondering if it is a gazebo version issue.

System Information
Ubuntu: 18.04
ROS: Melodic
Gazebo: 9.10.0
PX4: 1.9.2
Fresh Install: Yes.

@lguanrui lguanrui changed the title gazebo crashed with undefined symbol error: _ZN8mav_msgs4msgs10MotorSpeedC1Ev gazebo exited with undefined symbol error: _ZN8mav_msgs4msgs10MotorSpeedC1Ev Aug 26, 2019
@julianoes julianoes added Admin: More Information Needed Sim: SITL software in the loop simulation labels Aug 27, 2019
@julianoes
Copy link
Contributor

Are you sure this happens after a clean build?

Can you copy and paste the commands that you use to build?

@lguanrui
Copy link
Author

Here are the commands I used to build

$ mkdir ~/src
$ cd ~/src
$ git clone https://github.com/PX4/Firmware.git
$ cd Firmware
$ make px4_sitl gazebo

@lguanrui
Copy link
Author

Here are the launch files that I used:
posix_sitl.launch:

<?xml version="1.0"?>
<launch>
    <!-- Posix SITL environment launch script -->
    <!-- launches PX4 SITL, Gazebo environment, and spawns vehicle -->
    <!-- vehicle pose -->
    <arg name="x" default="0"/>
    <arg name="y" default="0"/>
    <arg name="z" default="0"/>
    <arg name="R" default="0"/>
    <arg name="P" default="0"/>
    <arg name="Y" default="0"/>
    <!-- vehicle model and world -->
    <arg name="est" default="ekf2"/>
    <arg name="vehicle" default="iris"/>
    <!-- <arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/> -->
    <!-- <arg name="world" default="$(find px4)/launch/tunnel_practice_1.world"/> -->
    <arg name="world" default="$(find px4)/launch/forest_house_500m_autel.world"/>
    <!-- <arg name="world" default="$(find fast_vision_central)/worlds/forest_house_500m_autel.world"/> -->
    <arg name="sdf" default="$(find mavlink_sitl_gazebo)/models/$(arg vehicle)/$(arg vehicle).sdf"/>
    <env name="PX4_SIM_MODEL" value="$(arg vehicle)" />
    <env name="PX4_ESTIMATOR" value="$(arg est)" />

    <!-- gazebo configs -->
    <arg name="gui" default="true"/>
    <arg name="debug" default="false"/>
    <arg name="verbose" default="false"/>
    <arg name="paused" default="false"/>
    <arg name="respawn_gazebo" default="false"/>
    <!-- PX4 configs -->
    <arg name="interactive" default="true"/>
    <!-- PX4 SITL -->
    <arg unless="$(arg interactive)" name="px4_command_arg1" value="-d"/>
    <arg     if="$(arg interactive)" name="px4_command_arg1" value=""/>
    <!-- <node name="sitl" pkg="px4" type="px4" output="screen"
        args="$(find px4)/ROMFS/px4fmu_common -s etc/init.d-posix/rcS $(arg px4_command_arg1)" required="true"/> -->

    <!-- Gazebo sim -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="gui" value="$(arg gui)"/>
        <arg name="world_name" value="$(arg world)"/>
        <arg name="debug" value="$(arg debug)"/>
        <arg name="verbose" value="$(arg verbose)"/>
        <arg name="paused" value="$(arg paused)"/>
        <arg name="respawn_gazebo" value="$(arg respawn_gazebo)"/>
    </include>
    <!-- gazebo model -->
    <!-- <node name="$(anon vehicle_spawn)" pkg="gazebo_ros" type="spawn_model" output="screen" args="-sdf -file $(arg sdf) -model $(arg vehicle) -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/> -->

    <include file="$(find px4)/launch/single_vehicle_spawn.launch" pass_all_args="true" />
</launch>
~            

single_vehicle_spawn.launch:

<?xml version="1.0"?>
<launch>

  <arg name="robot_name" default="uav1" />

  <group ns="$(arg robot_name)">
    <!-- Posix SITL environment launch script -->
    <!-- launchs PX4 SITL and spawns vehicle -->
    <!-- vehicle pose -->
    <arg name="x" default="0"/>
    <arg name="y" default="0"/>
    <arg name="z" default="0"/>
    <arg name="R" default="0"/>
    <arg name="P" default="0"/>
    <arg name="Y" default="0"/>
    <!-- vehcile model and config -->
    <arg name="est" default="ekf2"/>
    <arg name="vehicle" default="iris"/>
    <env name="PX4_SIM_MODEL" value="$(arg vehicle)" />
    <env name="PX4_ESTIMATOR" value="$(arg est)" />
    <arg name="mavlink_udp_port" default="14560"/>
    <arg name="mavlink_tcp_port" default="4560"/>
    <!-- PX4 configs -->
    <arg name="interactive" default="true"/>
    <!-- generate urdf vehicle model -->
    <arg name="cmd" default="$(find xacro)/xacro $(find px4)/launch/$(arg vehicle)_base_small.xacro rotors_description_dir:=$(find px4)/Tools/sitl_gazebo/models/rotors_description mavlink_udp_port:=$(arg mavlink_udp_port) mavlink_tcp_port:=$(arg mavlink_tcp_port) --inorder"/>
    <param command="$(arg cmd)" name="rotors_description"/>
    <param command="$(arg cmd)" name="robot_description"/>
    <!-- PX4 SITL -->
    <arg unless="$(arg interactive)" name="px4_command_arg1" value=""/>
    <arg     if="$(arg interactive)" name="px4_command_arg1" value="-d"/>
    <node name="sitl" pkg="px4" type="px4" output="screen" args="$(find px4)/ROMFS/px4fmu_common -s etc/init.d-posix/rcS $(arg px4_command_arg1)">
    </node>
    <!-- spawn vehicle -->
    <node name="$(arg vehicle)_spawn" output="screen" pkg="gazebo_ros" type="spawn_model" args="-urdf -param rotors_description -model $(arg robot_name) -package_to_model -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/>

    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher">
      <param name="tf_prefix" value="/$(arg robot_name)" />
    </node>

  </group>
</launch>

@julianoes
Copy link
Contributor

How do you use that launch file? And do you also rebuild everything in the catkin workspace?

@lguanrui
Copy link
Author

I use rosmon to launch the files like

$ mon launch px4 posix_sitl.launch

I didn't rebuild everything in the catkin workspace. Do I need to rebuild everything?

@TSC21
Copy link
Member

TSC21 commented Aug 27, 2019

@lguanrui you are not sourcing the config file for the Gazebo plugins and models:
$source Firmware/Tools/setup_gazebo.bash Firmware/build/px4_sitl/ Firmware/

https://github.com/PX4/Firmware/blob/master/Tools/setup_gazebo.bash

@lguanrui
Copy link
Author

@TSC21 I did this before the launching. Sorry I didn't mention it.

@TSC21
Copy link
Member

TSC21 commented Aug 27, 2019

@TSC21 I did this before the launching. Sorry I didn't mention it.

Do you have Gazebo installed from both OSRF sources and ROS? It may result in some issues. Otherwise, I would say you have conflictson the LD_LIBRARY_PATH. I would make sure that you are able to run the sim first using make px4_sitl gazebo.

@lguanrui
Copy link
Author

@TSC21 I did this before the launching. Sorry I didn't mention it.

Do you have Gazebo installed from both OSRF sources and ROS? It may result in some issues. Otherwise, I would say you have conflictson the LD_LIBRARY_PATH. I would make sure that you are able to run the sim first using make px4_sitl gazebo.

I just double checked. the project itself has install gazebo from OSRF sources and I installed gazebo from ROS too. However, I was able to run the make px4_sitl gazebo before running the sim.

@TSC21
Copy link
Member

TSC21 commented Aug 27, 2019

@TSC21 I did this before the launching. Sorry I didn't mention it.

Do you have Gazebo installed from both OSRF sources and ROS? It may result in some issues. Otherwise, I would say you have conflictson the LD_LIBRARY_PATH. I would make sure that you are able to run the sim first using make px4_sitl gazebo.

I just double checked. the project itself has install gazebo from OSRF sources and I installed gazebo from ROS too. However, I was able to run the make px4_sitl gazebo before running the sim.

So does make px4_sitl gazebo start Gazebo with the Iris model spawned and the PX4 daemon running?

@lguanrui
Copy link
Author

lguanrui commented Aug 27, 2019

@TSC21 I did this before the launching. Sorry I didn't mention it.

Do you have Gazebo installed from both OSRF sources and ROS? It may result in some issues. Otherwise, I would say you have conflictson the LD_LIBRARY_PATH. I would make sure that you are able to run the sim first using make px4_sitl gazebo.

I just double checked. the project itself has install gazebo from OSRF sources and I installed gazebo from ROS too. However, I was able to run the make px4_sitl gazebo before running the sim.

So does make px4_sitl gazebo start Gazebo with the Iris model spawned and the PX4 daemon running?

I just rerun it. The gazebo didn't start but the px4 daemon is running. Here are the messages:
Screenshot from 2019-08-27 10-24-07

How should I solve this problem?

@TSC21
Copy link
Member

TSC21 commented Aug 27, 2019

I would uninistall and reinstall Gazebo just to be sure. I am not sure what's causing that error at this stage. Try to alo unsource the ROS path from bashrc and rerun the make command.

@lguanrui
Copy link
Author

Hi all! After removing the OSRF sources, the simulator works! Thanks for helping! Closing this issue.

@akshatpandya
Copy link

Hi @lguanrui can you tell how did you remove OSRF sources? I'm getting a similar error.

@julianoes
Copy link
Contributor

Please don't necro bump. And the tinyxml2 linking issue should be resolved if you do brew upgrade and make clean

@AlexWUrobot
Copy link

AlexWUrobot commented Jul 11, 2023

I have the similar issue but cannot be solve yet. Thank you very much for the help

My platform is Ubuntu 20.04.
Use the latest MAVROS and PX4-autopilot
ROS version is noetic.

The error message is
gzserver: symbol lookup error: /home/zihan/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic/libgazebo_mavlink_interface.so: undefined symbol: _ZN8mav_msgs4msgs17CommandMotorSpeedC1Ev

image

The gazebo version is 11.13.0
image

image

I tried to re-install OSRF sources (Gazebo11)

sudo apt remove gazebo 
sudo apt remove gazebo11
sudo apt remove gazebo11-common

And then install it by

sudo apt install gazebo11
sudo apt install libgazebo11-dev

Then, we can make but cannot launch 'roslaunch px4 posix_sitl.launch'
Next try
sudo apt install ros-noetic-gazebo-ros-pkgs

image
However,
if just run roslaunch gazebo_ros empty_world.launch
There is no error.
image

@AlexWUrobot
Copy link

AlexWUrobot commented Jul 11, 2023

I solved it by change the path. Thanks TSC21
because I have a conflict in the catkin_ws in .zshrc (.bashrc)
image

After remove (comment) the catkin_ws in .zshrc (.bashrc):
Type 'echo $ROS_PACKAGE_PATH '
The wrong path looks like list
image
The correct path should be here
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin: More Information Needed Sim: SITL software in the loop simulation
Projects
None yet
Development

No branches or pull requests

5 participants