Frame does not exist when run Gazebo
I am using ubuntu 18.04, ros melodic to simulate my URDF robot in gazebo. Then I create a dynamic node to move the robot. When I publish gazebo_msgs/ModelState with reference_frame set as "world_ned" in the dynamic node I created before, I was getting an error : "Updating ModelState: for model[MyrobotName], specified reference frame entity [world_ned] does not exist " , even though I already used a static_transform_publisher in my launch file. But when I simulate it in my rviz, there is no error like I said before. This is my tf tree : and this is my launch file :
<launch>
<!-- Configurable arguments -->
<arg name="enable_rviz" default="true"/>
<arg name="robot_name" default="MyrobotName"/>
<node name="world2ned" pkg="tf" type="static_transform_publisher" args="0 0 0 0 0 3.1415 world world_ned 100"/>
<!-- Robot description -->
<arg name="model" default="$(find gb_description)/urdf/myrobotname.urdf"/>
<param name="robot_description" command="$(find xacro)/xacro $(arg model)" />
<arg name="x_pos" default="0.0"/>
<arg name="y_pos" default="0.0"/>
<arg name="z_pos" default="0.5"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>
<!-- Load configs in their node namespace -->
<rosparam command="load" file="$(find gb_sim)/config/dynamics.yaml"/>
<!-- Start nodes -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen"/>
<node name="dynamics_node" pkg="gb_sim" type="dynamics_node.py" output="screen"/>
<!-- RViz -->
<node if="$(arg enable_rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(find gb_description)/scene/test1.rviz"/>
<node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf" args="-urdf -model MyrobotName -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />
</launch>
Does anyone know how to solve it ?
Could you provide more details? Maybe an image of your tf tree?
Sure, I have already provided the image of my tf tree