-
Notifications
You must be signed in to change notification settings - Fork 3
Added capability to provide a key frame as starting configuration. #34
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
Conversation
|
Just curious, do you think it would be possible to set them by parameter (or) by yaml, instead of an XML file?. At the end, you are interested in the position information alone right? or am I wrong? |
eholum-nasa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits mostly, and use auto more often!
Other than that this is very, very handy!
| } | ||
| } | ||
|
|
||
| bool MujocoSystemInterface::set_override_start_positions(const std::string& override_start_position_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of those functions that we should unit test...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it is necessary before a merge? Or are should that be added to a future issue of adding unit tests...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future problems.
We went back and forth on this but ultimately we wanted something to preserve the state of the simulation including the velocity and control values. This lets you set the entire state of the sim using what is copied out of the simulate app as is, which is handy because it's not particularly human readable when models start to get complicated... e.g. This is one of our sims that has quite a few moveable, though not actuatable, components: I think @ndunkelb-nasa has found it pretty handy to just copy/paste those things out when testing different capabilities within a single simulation. E.g., tweaking admittance parameters. |
|
@eholum-nasa Thank you for explaining it. It totally makes sense |
|
Spoiler alert 🚨 We are currently working on the MuJoCo MJCF generation on the fly. We had a brainstorming session with Ortisa today. The idea is to reuse your work and add some more args to convert URDF on the fly. One of the features, we discussed is to set the scene file at run time, so we can also include this part into the scene or add a key pose part into the MJCF directly. Would that work for you guys? I'm trying to avoid hardcoding too many things in the URDF, because that way we lack flexibility to start with different poses. |
I would say, more explicitly, this enables a kind of "save and reload state" right from the simulation window. If you click this button, it will copy the current state in that xml format, and that is what I was trying to make loadable. In this specific case, the control values are important too, because I want the gripper to be actively applying force, rather than just holding its position which would cause the object to slip.
|
This would be awesome! I think we would be happy to share our thoughts about on the fly conversion if you are interested. We had thought about that, but decided against it for several reasons. It might make sense to talk about it in a different issue though. Regardless, providing a scene file at run time would definitely be nice! We have also thought about this a bit, but our infrastructure usually has a separate ROS package for a specific application, and we haven't figured out how to properly combine assets that need to be in that package with the assets in a base robot package. But obviously creating stuff on the fly might help solve that! |
Co-authored-by: Erik Holum <[email protected]>
Co-authored-by: Erik Holum <[email protected]>
Added capability to provide a key frame as starting configuration.

I mainly added this because we don't have a good way to get load an arbitrary mujoco configuration, other than just setting the initial positions of the joints that ROS cares about in the ros2_control xacro. Mujoco does support this, but we didn't really have an interface to do this. I added an optional parameter to the ros2 control hardware interface that can load that information on startup, so that you can easily save off a configuration, then pass it into your config at runtime to test from there again.
From the documentation I added:
This implementation mainly provides an optional parameter to use the keyframe from a provided file as the starting configuration. This mutually exclusive with the initial_value that can be used for state interfaces. This is intended to provide an alternative method to load an entire mujoco model state from a configuration that was saved by clicking 'Copy state' in the simulate window, and pasted into a config file. Expected use cases are to work on a specific part of an application that involves the environment being in a very specific starting configuration. If this parameter is an empty string, it will be ignored.
The parameter is passed in the ros2_control hardware interface parameters like so
The config files look like this when saved from the simulate window. (Time is ignored)
It has been implemented in the test configuration if you want to take a look!