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

How to set the Orientation of IMU in Robot Module #36

Open
kight71 opened this issue Jan 13, 2025 · 13 comments
Open

How to set the Orientation of IMU in Robot Module #36

kight71 opened this issue Jan 13, 2025 · 13 comments

Comments

@kight71
Copy link

kight71 commented Jan 13, 2025

After running mc_mujoco, the robot falls down from the beginning. According to the tips, I tried to add an IMU orientation in the Robot module as below:
_bodySensors.emplace_back("imu", "base_link", sva::PTransformd::Identity());
just like other sensors. Is this the right method to add an IMU in RobotModule? If it is wrong. what should I do to add the orientation of IMU.

@kight71
Copy link
Author

kight71 commented Jan 13, 2025

simplescreenrecorder-2025-01-13_16.48.01.mp4

When I start BWC, there is a green arrow fluttering everywhere. Does this relate to the setting of IMU?

@mmurooka
Copy link
Member

Is this the right method to add an IMU in RobotModule? If it is wrong. what should I do to add the orientation of IMU.

I assume you have added the IMU in the MuJoCo model (*.xml). If the IMU is added with the same rotation between the MuJoCo model and the robot module, there is no problem.

https://github.com/isri-aist/jvrc_mj_description/blob/da19888caa5f96bc9260615805f348f5d5212808/xml/jvrc1.xml#L212

When I start BWC, there is a green arrow fluttering everywhere. Does this relate to the setting of IMU?

The green arrow drawing depends on the situation and is not necessarily a problem with IMU.

In the video the robot is falling over from the beginning, why is that? I suggest you try with mc_rtc_ticker with sensor feedback disabled as described in the documentation.

@kight71
Copy link
Author

kight71 commented Jan 14, 2025

I tried as document described. Everything is correct as I using rviz and mc_rtc_ticker to simulate. The video is below:

simplescreenrecorder-2025-01-14_09.37.50.mp4

@kight71
Copy link
Author

kight71 commented Jan 14, 2025

I also checked xml file. I have already added an IMU in the xml file. Is it necessary to add an IMU description in cpp file?

@mmurooka
Copy link
Member

Is it necessary to add an IMU description in cpp file?

If “cpp file” refers to RobotModule, then Yes; the IMU settings must be consistent (e.g., same position and orientation) between the MuJoCo model (xml) and RobotModule (cpp).

@kight71
Copy link
Author

kight71 commented Jan 14, 2025

``> > Is it necessary to add an IMU description in cpp file?

If “cpp file” refers to RobotModule, then Yes; the IMU settings must be consistent (e.g., same position and orientation) between the MuJoCo model (xml) and RobotModule (cpp).

May I ask how should I add an IMU setting in RobotModule ,I didn't find any related code in jvrc1.cpp. I add this code in my RobotModule:
_bodySensors.emplace_back("imu", "base_link", sva::PTransformd::Identity());
This is robot xml description about base link:
<body name="base_link" pos="0.0 0.0 0.878 "> <freejoint name="Root" /> <geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="1 1 1 1" mesh="base_link"/> <geom type="mesh" rgba="1 1 1 1" mesh="base_link"/> <site name='imu' size='0.01' pos='0.0 0 0.0'/>
I wonder that code is correct or not.

@mmurooka
Copy link
Member

May I ask how should I add an IMU setting in RobotModule ,I didn't find any related code in jvrc1.cpp. I add this code in my RobotModule:

Yes, that is correct.

@kight71
Copy link
Author

kight71 commented Jan 17, 2025

May I ask how should I add an IMU setting in RobotModule ,I didn't find any related code in jvrc1.cpp. I add this code in my RobotModule:

Yes, that is correct.

I got it, thanke you.
However, I have a new question. The robot cannot walk stable in mujoco. I tried to adjust the parameter of damper for angular in both SignleSupport and DoubbleSupport. However, it does little help for the robot. The video is below:

simplescreenrecorder-2025-01-17_14.53.10.mp4

What parameter should I adjust to make the robot walk stable in mujoco.

@mmurooka
Copy link
Member

Try the followings:

@kight71
Copy link
Author

kight71 commented Jan 20, 2025

Try the followings:

  • Lower the CoM

      [BaselineWalkingController/etc/BaselineWalkingController.in.yaml](https://github.com/isri-aist/BaselineWalkingController/blob/23af8599b1abe13112bd2957e10b2565a46014eb/etc/BaselineWalkingController.in.yaml#L192)
    
    
         Line 192
      in
      [23af859](/isri-aist/BaselineWalkingController/commit/23af8599b1abe13112bd2957e10b2565a46014eb)
    
    
    
    
    
        
          
           refComZ: 0.825 # [m]
    
  • Reduce footstep strides

      [BaselineWalkingController/etc/BaselineWalkingController.in.yaml](https://github.com/isri-aist/BaselineWalkingController/blob/23af8599b1abe13112bd2957e10b2565a46014eb/etc/BaselineWalkingController.in.yaml#L97)
    
    
         Line 97
      in
      [23af859](/isri-aist/BaselineWalkingController/commit/23af8599b1abe13112bd2957e10b2565a46014eb)
    
    
    
    
    
        
          
           deltaTransLimit: [0.15, 0.1, 12.5] # (x [m], y [m], theta [deg])
    
  • Increase footstep duration

      [BaselineWalkingController/etc/BaselineWalkingController.in.yaml](https://github.com/isri-aist/BaselineWalkingController/blob/23af8599b1abe13112bd2957e10b2565a46014eb/etc/BaselineWalkingController.in.yaml#L95)
    
    
         Line 95
      in
      [23af859](/isri-aist/BaselineWalkingController/commit/23af8599b1abe13112bd2957e10b2565a46014eb)
    
    
    
    
    
        
          
           footstepDuration: 0.8 # [sec]
    

Thank you for your help. I met a new problem.The video is below:

https://github.com/user-attachments/assets/fd7848ba-853f-49fc-bfeb-1836af47cdbd
As you can see, the contact force is weird sometime. Is this bug related to rsdf file or something else?

@mmurooka
Copy link
Member

This seems to be a problem with mujoco's mesh contact detection. I suggest replacing the collision shape of the foot link with a simple BOX.

@kight71
Copy link
Author

kight71 commented Jan 21, 2025

This seems to be a problem with mujoco's mesh contact detection. I suggest replacing the collision shape of the foot link with a simple BOX.

I solved the question by using the method you mentioned. Thank you! Now the robot can walk well in x axis. However, things changed when the robot walking in y axis. The robot has a kind of oscillation when walking in y axis. The videos are below:

simplescreenrecorder-2025-01-21_14.18.16.mp4
simplescreenrecorder-2025-01-21_14.18.49.mp4

I tried to adjust the angular parameter of SingleSurpport and DoubleSupport and dcmGainP. But it does nothing to walk. Do I need to adjust other parameters or keep adjusting the parameters mentioned in the comment?

@mmurooka
Copy link
Member

Since the robot's legs are fully extended and its feet are not reaching the target position, it is recommended to further reduce refComZ as described above to bend the legs.

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