robomechanics / quad-sdk

Software tools for agile quadrupeds, developed by the Robomechanics Lab at Carnegie Mellon University.
https://robomechanics.github.io/quad-sdk/
MIT License
697 stars 133 forks source link

real robot controller example?! #341

Closed elpimous closed 1 year ago

elpimous commented 1 year ago

Hello all, Do you have a controller example, working on a real robot?

Humm, if I want to keep actual walk controller on my real robot, I just need to do like hardware_interface.h/c? Thanks

jcnorby commented 1 year ago

Hey there! I'm guessing you are asking for instructions for running the software on robot hardware rather than in simulation.

First, a disclaimer - Quad-SDK is not guaranteed (or even designed) to work seamlessly with every quadruped hardware platform out there, since there are so many good ones these days! It would be difficult for us to support each of them, especially since many people like to have their own hardware setups/integrations. We made a specific decision to focus the software on what would apply to the largest portion of these robots (high and mid-level motion planning, low-level joint control), but once our system computes joint torques, it's somewhat up to the user to make sure they get to where they need to go.

That said, we did try to make this as easy as possible by both providing a) a simulator so folks could tinker with/extend the software without needing a hardware platform, and b) the abstract HardwareInterface class (as you mentioned) so that integrating with other robots would be as easy as possible. The derived HardwareInterface provided is for the Spirit 40 robot (the one we have in lab), but should serve as a good template for your particular platform.

In terms of actually launching the stack on a hardware platform, you can refer to this page in the Wiki for an example for how we do it in our lab. Your mileage may vary, but our general approach was to launch high-rate nodes on the robot (e.g. NMPC and joint control, this is what is launched by robot_driver.launch), and slower-rate nodes on a remote computer (global planning, visualization, NMPC if you want it computed really fast).

Hope this helps!

elpimous commented 1 year ago

@jcnorby what a good answer... Thanks a lot.... Invertigating...

1/ Can I / where can I change gait params? 2/ in one of your videos, the robot jumps, during walk... How did you do that? Stop walk - > jump - > restart walk? Mix both controllers? how did you do for jump : ask for certain body height? Really exciting!!!

jcnorby commented 1 year ago

Gait parameters are set in local_planner.yaml, specifically the period, duty_cycles, and phase_offsets params, which respectively set which period of the gait, the fraction of the period for which that leg is in stance, and the time within one gait cycle that the leg touches down. Legs and joint numbering is explained here.

Leaping is handled seamlessly by altering the reference trajectory and contact schedule. The reference trajectory comes from the global planner (although you could hardcode your own leap if you wanted to override this), and the contact schedule is updated to add a period of full stance during the leaping and landing phases with no contact during flight (this is handled here).

jcnorby commented 1 year ago

Closing this because I think the initial question was addressed, if not we can reopen (or make new issues as needed).

elpimous commented 1 year ago

Thanks a lot @jcnorby