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

[MuJoCo] enable to use mujoco simulator #557

Merged
merged 133 commits into from
Oct 29, 2023

Conversation

sugikazu75
Copy link
Member

@sugikazu75 sugikazu75 commented Sep 10, 2023

what is this

simulation interface for mujoco simulator.

usage

cd ~/ros/jsk_aerial_robot_ws
rosdep install -y -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO
catkin build

then,

roslaunch dragon bringup.launch real_machine:=false simulation:=true headless:=false mujoco:=true 
mujoco_dragon.mp4

TODO

  • test under actuated robots which use flight controller in spinal (e.g. hydrus)
  • path CI test

@tongtybj
Copy link
Collaborator

@sugikazu75

I found that following command is not support in ubuntu:xenial with ros kinetic.

bpy.ops.wm.collada_import(filepath=input_file)

This cuase following error, which I think the version of blender (2.75) is too old or has some bug.

  File "/home/ros/aerial_robot_ws/src/aerial_robot_3rdparty/mujoco_ros_control/scripts/convert.py", line 49, in process_subdirectories
    bpy.ops.wm.collada_import(filepath=input_file)
  File "/usr/share/blender/scripts/modules/bpy/ops.py", line 189, in __call__
    ret = op_call(self.idname_py(), None, kw)
AttributeError: Calling operator "bpy.ops.wm.collada_import" error, could not be found

After a lot of trial and consideration, I decide to give up to convert collada to stl in kinetic distribution which is no longer used by our current active members.

But we still need to pass CI for kinetic distribution. So I am going to add a condition processing that skips the conversion in the CMakeLists.txt for each robot.

@sugikazu75
Copy link
Member Author

But we still need to pass CI for kinetic distribution. So I am going to add a condition processing that skips the conversion in the CMakeLists.txt for each robot.

@tongtybj I agree with you.

@tongtybj
Copy link
Collaborator

@sugikazu75

can you add a rostest that uses MuJoCo for mini_quadrotor?

https://github.com/jsk-ros-pkg/jsk_aerial_robot/blob/master/robots/mini_quadrotor/test/CMakeLists.txt

@sugikazu75
Copy link
Member Author

@tongtybj
Copy link
Collaborator

@sugikazu75

Yes, it is absolutely wired.
I am going to find reason with tongtybj@1bffcfb

@tongtybj
Copy link
Collaborator

@sugikazu75

Interesting result:

+ ls /home/runner/catkin_ws/src/jsk_aerial_robot/robots/mini_quadrotor/mujoco/
ls: cannot access '/home/runner/catkin_ws/src/jsk_aerial_robot/robots/mini_quadrotor/mujoco/': No such file or directory

https://github.com/tongtybj/aerial_robot/actions/runs/6605040325/job/17939813433#step:5:7544

@tongtybj
Copy link
Collaborator

#557 (comment) is solved by sugikazu75#3

tongtybj and others added 3 commits October 28, 2023 22:18
[Mujoco][Github Action] avoid to back to the original path because of  the symbolic link
[Mujoco][Mini Quadrotor] skip mujoco test in ubuntu 16.04 kinetic
@sugikazu75
Copy link
Member Author

@tongtybj
Thank you for your contribution.
I added bug fix in mujoco_ros_control and confirm CI is passed in sugikazu75/jsk_aerial_robot@46049ae.

I want you to merge JSKAerialRobot/aerial_robot_3rdparty#14 and JSKAerialRobot/aerial_robot_3rdparty#15.

@tongtybj
Copy link
Collaborator

Copy link
Collaborator

@tongtybj tongtybj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM

include_directories(
${catkin_INCLUDE_DIRS}
${GAZEBO_INCLUDE_DIRS}
include
${MUJOCO_ROOT_DIR}/include
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line causes following error in catkin-lint, because this directory would not appear before build.
https://github.com/jsk-ros-pkg/jsk_aerial_robot/actions/runs/6167161992/job/16737709229?pr=557#step:6:86

So, I suggest move the installation of mujoco to https://github.com/JSKAerialRobot/aerial_robot_3rdparty, and refer to https://github.com/JSKAerialRobot/aerial_robot_3rdparty/tree/master/3rdparty/osqp to insatall mujuco header files and libraries.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you agree with this idea, we can also move aerial_robot_simulation/src/mujoco_ros_control.cpp and aerial_robot_simulation/src/mujoco_visualization_utils.cpp to https://github.com/JSKAerialRobot/aerial_robot_3rdparty/tree/master

mujoco_ros_control::MujocoRosControl mujoco_ros_control(nh);

// viewer
MujocoVisualizationUtils &mujoco_visualization_utils = MujocoVisualizationUtils::getInstance();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sugikazu75 Please consider the headless mode for mojuco. The most straightfoward way is to comment out the related codes if the headless flag is true. headless flag can be set from rosparam

@tongtybj tongtybj merged commit e339106 into jsk-ros-pkg:master Oct 29, 2023
6 checks passed
@tongtybj
Copy link
Collaborator

@sugikazu75

Eventually, we succeed to merge this PR as a new milestone for our system. Thanks for your tremendous effort!

BTW, I hope you can draw a new diagram about our simulation system based on UML proposed in #565 .

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

Successfully merging this pull request may close these issues.

2 participants