There’s two ways to initialize joint value of a give robot model:
-
modify the
originattribute of<joint>in urdf file -
add
-J JOINT_NAME JOINT_VALUEwhen spawn the robot
The first method will make default joints value wired, so I would suggest to use second method.
But there’s still a bug on gazebo when initializing joint value. Current workaround is:
<arg name="paused" default="true" doc="Starts gazebo in paused mode" />
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" default="worlds/empty.world"/>
<arg name="paused" value="$(arg paused)"/>
<arg name="gui" value="$(arg gui)"/>
</include>
<node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot
-z 0.0
-J shoulder_lift_joint -1.57
-J elbow_joint 1.001
-unpause
" respawn="false" output="screen" />We need to launch the Gazebo simulation paused so that physics is off. Then use -unpause flag with the spawner to turn on the physics.