chvmp / champ

MIT Cheetah I Implementation
BSD 3-Clause "New" or "Revised" License
1.47k stars 342 forks source link

How can I run robot in rest_mode? #65

Closed iamchien closed 2 years ago

iamchien commented 2 years ago

Hi @grassjelly and champ's developers, I'm stuck in the control robot in rest_mode using the keyboard. I saw mini-cheetah in this gif (the white robot) do it. How can I run with your simulated model? Thanks.

grassjelly commented 2 years ago

Hi, you would need a joystick to control the body's pose. Alternatively you can create a publisher using geometry_msgs/Pose to 'body_pose' topic.

iamchien commented 2 years ago

What is your idea about rest mode? I think the idea is as follows: First, set a new pose of the body, then set a new position of each toe as the current value. Then calculate angle through inverse kinematic formula, right?

grassjelly commented 2 years ago

you can do that by changing the z value which is the height of the robot

iamchien commented 2 years ago

That's exactly what I've seen in other developers with their 4-legged project. I don't obvious it. Please tell me more

grassjelly commented 2 years ago

You can use this as a starting point https://github.com/chvmp/champ_teleop/blob/master/champ_teleop.py#L102-L120 . Rather than using the values from the joystick, you can slowly increase/decrease body_pose_lite.z until the robot reach the height that you want

iamchien commented 2 years ago

Thanks, I also asked about whether or not possible to do rest_mode following steps which I mentioned above at r/robotics on Reddit. After that, I read your solution a few days ago and what I do not understand is the math behind it. It seems strange to me. There's nothing better than having it explained by its own author. That's why I open this issue. Can you explain it here? Or you can contact me via my email if it needed.

iamchien commented 2 years ago

I wanna do rest_mode before do any other gait. So it can be as an experiment. I'm writing a code to do my idea, but I still need your idea. It's really worth it to me.

Quothd commented 2 years ago

I have programmed a transition to z0.5 and repeatedly send z = 0.5. This gives me a rest pose. I also have an inactivity route be that transitions to rest after 30 seconds and turns off power to the servos after 60.

iamchien commented 2 years ago

@Quothd You did it on a real robot? Unfortunately, I don't have a real one here. But I would like to see your, thanks

Quothd commented 2 years ago

I'm away this weekend but realised that because mine is spending so much time on its stand, I needed more control so I modified the teleop node to support a web interface with touch button for stand / lie down, pose / walk and power control for the servo relay.

Relay servo power control makes it so much easier to switch between sim and robot control without needing to reinitialise anything.

The code needs a lot of cleaning up but happy to share if interested

iamchien commented 2 years ago

@Quothd I'm glad to see your. Have you got champ's idea about rest_mode? Please tell me! I'm stuck in few days.

grassjelly commented 2 years ago

Closing this for now as this is not really an issue.

iamchien commented 2 years ago

@grassjelly Ok, just want to say sorry.