-
Notifications
You must be signed in to change notification settings - Fork 772
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
spawn_model -J initial joint positions not working #93
Comments
The ability to specify initial joint positions is still broken in the current gazebo_ros_pkgs - any idea why @hsu? Thanks! |
seems to be working for me using the double pendulum example:
Can you confirm it's still broken? |
Its still broken with Baxter using a URDF, but your SDF version does work on my computer using the double pendulum example. To reproduce, first get the Baxter URDF:
Then (replace the file location of the URDF):
This should start baxter with no potential energy in its joints (arms down), but instead I see Baxter's hands straight out on both sides and they fall when the simulation starts. |
Not sure why yet. Calling set configuration through rosservice seems to work after the model has been spawned: rosservice call /gazebo/set_model_configuration '{ model_name: "baxter", urdf_param_name: "robot_description", joint_names: [ "right_s0", "right_s1", "right_e0", "right_e1", "right_w0", "right_w1", "right_w2", "left_s0", "left_s1", "left_e0", "left_e1", "left_w0", "left_w1", "left_w2" ], joint_positions: [ -0.272659, 1.04701, -0.00123203, 0.49262, -0.0806423, -0.0620532, 0.0265941, 0.192483, 1.047, 0.000806359, 0.491094, -0.178079, -0.0610333, -0.0124707 ] }' must be something in the spawn service. Side note, I had to modify your urdf to replace
or
|
Was there ever any resolution to this problem? Could it have been a namespace problem induced by using a urdf to load the model instead of an sdf file? |
I take back the namespace comment. Still, was there ever a solution to this? |
Hi Daniel, what version of gazebo are you using? Could be related to this bug below? https://bitbucket.org/osrf/gazebo/issue/1138/set-joint-positions-in-jointcontroller John On Thu, Aug 7, 2014 at 11:54 PM, Daniel Solomon notifications@github.com
|
AFAIK it was never fixed |
I'm using the debian version 1.9.5 compatible with ROS hydro. Is there any workaround? Like Dave, I'm just trying to set the initial joint position directly (during roslaunch). |
seems to work with gazebo 4.x release. I am testing in branch
testing gazebo 1.9 branch next. |
I made the following observations when trying to use The test file in the Then I tried to use the In the end, I added all the transmissions, gazebo_ros_control plugin and ros_controllers stuff again and started gazebo in "running" mode.....after running a second I have not yet investigated further what causes this behavior, but I wanted to document this here! |
I also noticed that while the simple model worked fine, other models may not work. Maybe a race condition somewhere at start up? Will look into this in more detail. |
It looks like everything is fine up to https://github.com/ros-simulation/gazebo_ros_pkgs/blob/indigo-devel/gazebo_ros/src/gazebo_ros_api_plugin.cpp#L1472 |
I wonder if it's because Model::jointController hasn't been initialized yet when this function is called. |
please give gazebo branch set_joint_position_on spawn (c8d353e) a try? thanks. |
Hmm, the branch seems to work for the test you added. |
…leeping for 1 second to avoid race condition. this branch should only be used for debugging, merge only as a last resort.
…ulation#93), sleeping for 1 second to avoid race condition. this branch should only be used for debugging, merge only as a last resort.
Is there any way to do something similar for Gazebo 2.2.x? |
Also w.r.t. 99b9dc5, it doesn't always work. |
I also did some experiments with It seemes to work (most of the time) for "small" models, e.g. just a manipulator (e.g. Univeral UR5). It appears to me that it also depends on the point in time at which the controllers are started...? |
…ulation#93), sleeping for 1 second to avoid race condition. this branch should only be used for debugging, merge only as a last resort.
…ulation#93), sleeping for 1 second to avoid race condition. this branch should only be used for debugging, merge only as a last resort.
99b9dc5 works for me, This will solve our problem posted on I'm testing on setting baxter gazebo simulation using baxter_gazebo.install of indigo-devel of gazebo_simulator package on indigo. |
temporary hack to **fix** the -J joint position option (issue #93), sleeping for 1 second to avoid race condition. this branch should only be used for debugging, merge only as a last resort.
@ironmig Now I have a strange situation: to illustrate the problem I downloaded the SimpleScreenRecorder program to show what happens, every time I run the simulation without SimpleScreenRecorder recording the rover flies away, but while I'm recording everything behaves normally and the rover falls as expected. I thought it might be related to the 4 CPUs being a bit more busy than usual, so I downloaded the |
Have you updated your ROS install lately? Ran stress on all my cores and still cannot get this issue to occur (kinetic, gazebo 7.13 now). |
@ironmig I had issues as long as nothing else way hogging the CPU, if you don't have this issue without stress test then you won't have it with stress either. My ROS installation Kinetic and Gazebo 9. |
A bit of a limp comment, but I can second @Nurgak's experience. I just had to change my gazebo node to start up paused in order to have the -J argument work, otherwise it would fail as described. |
I tried the previous method #93 (comment), but it doesn't work for gazebo 9 and bullet physics engine. And it works for gazebo9 with ODE or dart physics engines. I think this issue is something about gazebo. We have some discussions at gazebo. |
I experienced this issue with ROS Kinetic and Gazebo 7 (ros-kinetic-desktop-full version). Occurs on very large model (hexapod) for both paused and unpaused starts. My workaround was to wait until Gazebo had finished loading and then run |
Is there any solution in sight for this? It's still occuring on Kinetic+gazebo7.
@littlejohnyang Did you manage to resolve this? I also want the robot to be able to snap back to position. |
what is the Gazebo version you are using? This worked for me when I updated Gazebo 7 to 7.15 after adding the mirror. On Gazebo 7.0.0 it really didn't work for me. |
@musamarcusso I am using Gazebo 7.15. What worked for you exactly? I have got the workaround working to reset the robot to a position following littlejonyang's method but it is not snapping to position. And what do you mean by mirror? |
The mirror would be
then I updated Gazebo. For some reason only then 7.15 was installed. The way it worked for me was to start Gazebo with the physics paused and spawn the robot (I named it
|
Thanks for that but I already have the initial pose working. However, my robot is teleoperated and I want the user to be able to reset it to the initial pose when it gets stuck (e.g. singularity etc.). And I want it to snap back into position without any dynamics involved. |
ah, you mean resetting the simulation completely or kind of re-spawning? |
Similar to that but ONLY the robot for now. |
I experienced this issue with ROS Kinetic and Gazebo 9 (ros-kinetic-desktop-full version).. @musamarcusso your solution initially worked, but it started showing strange behaviour again. |
-J command not working in Gazebo 9 and ros melodic |
I find it hysterical 8 years later a bug like this still exists lmao. |
I didn't read all the previous comments, but -J works for me on current gazebo9 + melodic. This is my spawner:
|
I figured out the issue, in order for -J command to work we need to launch the Gazebo simulation paused so that physics is off. Then use
Though the |
I'm convinced it is a race condition. With the exact same launch file, 1 out of 10 times, |
Yes, I also believe it's a race condition. I wouldn't recommend using the |
Also come across this bug when trying to state an initial position of a dual-arm robot with -J tags. Works correctly when setting pause to true, and then starting the simulation using the start button in the Gazebo GUI as @mintar suggests. Thank you! |
Is the above currently the best solution for this issue or can anybody point me to a more reliable fix/solution? |
@sccashma as far as I am aware the only reliable solution to this problem is by using the pause/unpause. Also on Gazebo 9/Melodic. This is an open issue from 2013, so I don't think there is going to be a reliable fix anytime soon. |
Is there any update to this? Pause/Unpause approach does not work on Gazebo9/Kinetic. |
My bad. Pause/Unpause method actually works on Gazebo9/Kinetic environment |
using the command line argument -J
i spent a lot of time investigating this today to no avail
@hsu
The text was updated successfully, but these errors were encountered: