-
Notifications
You must be signed in to change notification settings - Fork 1
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 reset #29
Comments
Reset gazebo model joint position which spawned from ros URDF with gazebo_ros_control pluginNOTE: this didn't work with ros kinetic and gazebo 7. But it seems work with ros kinetic and gazebo 9. But it doesn't work with gazebo 9 (9.0.0-1~xenial ) and bullet physics engine. # stop ros controllers should before pause physics, or will be blocked
rosservice call /controller_manager/switch_controller [] ["arm_gazebo_controller"] 2
# pause physics
rosservice call /gazebo/pause_physics
# rosrun gazebo_ros spawn_model ....
# set model joint configuration with URDF parameter
rosservice call /gazebo/set_model_configuration '{model_name: "robot", urdf_param_name: "robot_description", joint_names:['shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint','wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'], joint_positions:[1.2, 0.3, -1.5, -0.5, -1.5, 0.0]}'
sleep 5
# unpause physics
rosservice call /gazebo/unpause_physics
# after unpause the robot will be set to the previous pose(before paused)
# restart ros controllers should after unpaused physics, or will be blocked
rosservice call /controller_manager/switch_controller ["arm_gazebo_controller"] [] 2 If we want start gazebo without ros controller # We can start gazebo with ROS service support
roslaunch gazebo_ros empty_world.launch
# insert PR2 or UR10 robot in gazebo
# set model joint configuration directly without URDF
rosservice call /gazebo/set_model_configuration '{model_name: "ur10", joint_names:['shoulder_pan_joint', 'shoulder_lift', 'elbow','wrist_1', 'wrist_2', 'wrist_3'], joint_positions:[2, -1, -1.5, -1.5, -1.5, 0.0]}' |
We find that
<node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot" respawn="false" output="screen" /> then we can set the model configuration correctly with the following procedure
rosservice call /gazebo/set_model_configuration '{model_name: "ur10", joint_names:['shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint','wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint'], joint_positions:[1.0, 0.0, 1.9, 0.2, 0.0, 0.0]}'
AppendixWe reproduce this following these steps:
The <?xml version="1.0"?>
<sdf version="1.6">
<world name="default">
<physics type='ode'/>
<include>
<uri>model://ground_plane</uri>
</include>
<include>
<uri>model://sun</uri>
</include>
<include>
<uri>model://ur10_clone</uri>
<name>ur10</name>
<pose>0 -2 0 0 0 0</pose>
<plugin name="ros_control" filename="libgazebo_ros_control.so">
</plugin>
</include>
</world>
</sdf> where we clone the
/arm_gazebo_controller:
type: velocity_controllers/JointTrajectoryController
joints:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint load the parameters into the namespace rosparam load $(rospack find assembler_gazebo)/config/arm_velocity_controller_ur5.yaml /ur10
rosrun controller_manager spawner --namespace="ur10" "arm_gazebo_controller"
NOTE: you can also pause physics after stopping controller and unpause physics before starting controller, and it will also work correctly. |
Possible causes of reset failure
Only if we set the This will reset the position, but for some physics engine, the interface may not supported by ros, so it failed.
|
In order to robot learning, we always need the
reset
function.But we should know that gazebo is still not friendly with this! Another thing is about gazebo robot control which is not ready for robot arm control in the context of robot learning which needs large quantities of repetitive operations with contact. I think these are the larger issues we have to fix in the future ROS and Gazebo. The ROS and gazebo for robot arm learning simulation are still not ready!
Reset joint position
Reset joint position can' work with ros controllers. See spawn_model -J initial joint positions not working #93.
But something maybe different with gazebo9, see #29 (comment)
Reset World
Currently,
reset_world()
will not reset time(we test this in gazebo 9 byrosservice call /gazebo/reset_world
), andreset_simulation
will reset time. see issues with reset buttons.Reset ros controller for gazebo
At present, we find that resetting the ros controllers is not correct.
And the ros controller can't get the correct joint state by robot HardwareInterfaceSim, especially on cases that after
reset gazebo
andcontact
occurs in gazebo.Other issues
/joint_states
will return wrong and very large data after self collision or contact with other objects. And it can't be reset at present!Reference
The text was updated successfully, but these errors were encountered: