0
$\begingroup$

Rosanswers logo

Hi,

Is there anyway to set the initial joint angles of the robot ? After reading a lot of pages and some packages of several robots, I have seen that it can be done by adding some args to the spawning node. However, I haven't been able to make it work for me. Right now, what I am doing is:

<node name="arm_base_spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model schunk_lwa4p_and_base 
    -J schunk_lwa4p_and_base::J_foldingSupport 0.075 
    -J schunk_lwa4p_and_base::J1_PowerBall -1.5607 
    -J schunk_lwa4p_and_base::J2_PowerBall -0.3817"
    respawn="false" output="screen" />

The robot is a lwa4p mounted over a mobile platform. For doing that, I am using xacros, being the robot schunk_lwa4p_and_base the union of all the xacros.

I would really appreciate if you can help me. Thank you in advance,

JLuis Samper


Originally posted by Samper-Esc on ROS Answers with karma: 50 on 2015-08-24

Post score: 1


Original comments

Comment by dornhege on 2015-08-24:
Do you need that from config file? Or would just setting defaults in the URDF be sufficient?

Comment by Samper-Esc on 2015-08-24:
Setting defaults is sufficient

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Start gazebo paused, then have spawn_model unpause gazebo.

<include file="(find gazebo_ros)/launch/empty_world.launch">
   ...
   <arg name="paused" value="true">
</include>

<node name="arm_base_spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model schunk_lwa4p_and_base 
    -J schunk_lwa4p_and_base::J_foldingSupport 0.075 
    ...
    -unpause 
    ..."/>

If this does not work, you can make your own version of "spawn_model", where you can pause gazebo, set the configuration, reset your joint controller, then unpause gazebo.

Some links I found helpful:

https://github.com/ros-simulation/gazebo_ros_pkgs/issues/93 https://github.com/ros-simulation/gazebo_ros_pkgs/blob/kinetic-devel/gazebo_ros/scripts/spawn_model


Originally posted by bsaund with karma: 161 on 2017-02-08

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by mogumbo on 2019-03-21:
This odd little workaround works for me. Thank you, bsaund :) Can anyone explain what's going on here in detail? I assume the controllers are somehow seeing different initial joint states if Gazebo is paused during initialization. Is there any plan to implement a more elegant solution? I might be able to make this contribution if I can better understand the problem.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.