Skip to content
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

Control arm using mujoco_ros_control #34

Closed
Daviesss opened this issue Sep 25, 2024 · 14 comments
Closed

Control arm using mujoco_ros_control #34

Daviesss opened this issue Sep 25, 2024 · 14 comments

Comments

@Daviesss
Copy link

I have been able to get some topics up from mujoco to ros , my question is how do i control robot arm using the mujoco_ros_control package . I will be glad if i get a direction .

@DavidPL1
Copy link
Contributor

You can take a look at https://github.com/ubi-agni/franka_ros_mujoco as an example.

There are 3 things you have to consider:

  1. you have to load a URDF into ROS
  2. the joint names you want to control must be consistent in the mujoco model and URDF
  3. you have to load the control plugin and define which hardware interface to load

To 3: this would be this part:
https://github.com/ubi-agni/franka_ros_mujoco/blob/852a184310ab2a04a0286d5d348f585a5b7b2983/config/default_mjplugin_config.yaml#L1-L5

However, the panda robot uses a custom hardware interface, normally the default interface suffices. In that case instead use:

MujocoPlugins:
  - type: mujoco_ros_control/MujocoRosControlPlugin
    hardware:
      type: mujoco_ros_control/DefaultRobotHWSim
      control_period: 0.001

@Daviesss
Copy link
Author

Daviesss commented Sep 26, 2024 via email

@Daviesss
Copy link
Author

Daviesss commented Oct 4, 2024

Hello ,

Thanks for the reply last time . After following the procedures above . I get the error below:

[ WARN] [1728034634.349682409, 69.080000000] [ros.tf2_ros] [/mujoco_server] [TransformListener::subscription_callback_impl]: Detected jump back in time of 0.011s. Clearing TF buffer.

[ WARN] [1728034824.509699327, 253.918000000]: Moved backwards in time (probably because ROS clock was reset), re-publishing joint transforms!

Also , i am not still able to control the robot via ROS. The plugins has been added and all procedure was followed.

@DavidPL1
Copy link
Contributor

DavidPL1 commented Oct 4, 2024

Could you please share the model file, plugin configuration and other necessary ROS packages to run your setup (e.g. robot description)?

@Daviesss
Copy link
Author

Daviesss commented Oct 7, 2024

Could you please share the model file, plugin configuration and other necessary ROS packages to run your setup (e.g. robot description)?

Yes i can , where can i send it to you? Reason why is because the urdf isnt open source yet. But i can send to you.

@Daviesss
Copy link
Author

Daviesss commented Oct 8, 2024

Could you please share the model file, plugin configuration and other necessary ROS packages to run your setup (e.g. robot description)?

Yes i can , where can i send it to you? Reason why is because the urdf isnt open source yet. But i can send to you.

Hello good day, i will be glad if i can get a feedback on this .

kind regards.

@DavidPL1
Copy link
Contributor

DavidPL1 commented Oct 8, 2024

Hi, I'll have a look if you send a zip archive to my work mail address: [email protected]

Make sure though to keep the size minimal by including only strictly necessary files.

@Daviesss
Copy link
Author

Daviesss commented Oct 8, 2024

Hi, I'll have a look if you send a zip archive to my work mail address: [email protected]

Make sure though to keep the size minimal by including only strictly necessary files.

Thanks . To be clear again what files should i send over?

@DavidPL1
Copy link
Contributor

DavidPL1 commented Oct 8, 2024

The mujoco xml, any non-opensource package you are using to upload your robot description, your control and plugin configuration files and a launchfile.

Ideally you would make a minimal catkin workspace intended to launch your robot for control and send me the zipped src directory.

@Daviesss
Copy link
Author

Daviesss commented Oct 8, 2024

Hi ,
I just sent an email over. Kindly check.

@DavidPL1
Copy link
Contributor

DavidPL1 commented Oct 8, 2024

From what I can see you do not provide a plugin configuration file, hence the control plugin is not being loaded.
Additionally you still need to upload the URDF, otherwise ROS has no information about your robot whatsoever, thus ROS Control can not work.

Please add the necessary configuration files and try again. I'd also suggest writing a separate package for your robot instead of adding files to a clone of this repository, this would make your work much more easy to read and debug.
Take the franka_mujoco_ros as an example on how to structure such a package.

@Daviesss
Copy link
Author

Daviesss commented Oct 8, 2024

Can you check the

arg name="plugin" default="$(find mujoco_ros)/config/default_mjplugin_config.xml tag in the launch file . The plugin is allocated to this .xml file .

Also, when you mean loading urdf . Do you mean spawning the robot into gazebo (which requires a urdf format) ?

Screenshot from 2024-10-08 17-58-01

@DavidPL1
Copy link
Contributor

DavidPL1 commented Oct 8, 2024

arg name="plugin" default="$(find mujoco_ros)/config/default_mjplugin_config.xml tag in the launch file . The plugin is allocated to this .xml file .

Yes, that config file would be correct. Now I see you've set the wrong argument. It should be mujoco_plugin_config instead of plugin.

Once you correct this, the terminal will print something like "waiting for URDF to become available on the parameter server" and nothing else will happen, because you are still missing the URDF.

Also, when you mean loading urdf . Do you mean spawning the robot into gazebo (which requires a urdf format) ?

No. Gazebo uses SRDF, which is an extension of URDF. You don't need to spawn the Robot in Gazebo, that's the part we want to replace in this project and what you have done so far.

Typically you have a simulated or real robot, defined by real world physical properties or a simulation model (mujoco xml in mujoco_ros or SRDF in Gazebo).
Then you have the ROS side of things, which does not care if your robot is real or simulated, but needs some sort of representation of the real/simulated robot, i.e. the robot description.
This is what you need for ROS Control to work, no matter which simulation you are using.

In the case of franka_ros_mujoco this is generated and uploaded with these lines:
https://github.com/ubi-agni/franka_ros_mujoco/blob/852a184310ab2a04a0286d5d348f585a5b7b2983/launch/launch_arm.launch#L37C3-L45C11

If you don't know how to write a robot description package for your robot (if it is a custom one), there are a lot of tutorials available online. If you are using an existing robot, chances are there is a robot description package available which you could use. In both cases you have to make sure that the naming of joints is consistent between URDF and the mujoco model.

@DavidPL1
Copy link
Contributor

Closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants