qiayuanl / legged_control

Nonlinear MPC and WBC framework for legged robot based on OCS2 and ros-controls
BSD 3-Clause "New" or "Revised" License
854 stars 217 forks source link

contactState_ needed for Legged Control ??? #29

Closed elpimous closed 1 year ago

elpimous commented 1 year ago

Hello, is those variables really necessary for the controller?

https://github.com/qiayuanliao/legged_control/blob/eff523ddec6b392414073d7ff5f1534cd411c533/legged_examples/legged_unitree/legged_unitree_hw/src/UnitreeHW.cpp#LL57C3-L59C4

My robot lib doesn t have it.. Thanks Vincent

qiayuanl commented 1 year ago

Yes, it is needed for this project. However, you can hack and use the MPC output as the contact state. I may write some code for this feature in the future.

elpimous commented 1 year ago

Ohhh bad for me 😭 Thanks friend for the quick answer. Now my robot code is nearly ready. I tested a standup, and motors jiiters. I am missing those contactstates. Can I use an existing variable? Will you have time, very soon, to code the mpc hack you said? Have a nice day.

elpimous commented 1 year ago

hi, @qiayuanliao , did you have time to add MPC output as the contact state ? Thanks.

elpimous commented 1 year ago

Hi Jim. Any hope for any mpc contact states? See you. Vincent

qiayuanl commented 1 year ago

Sorry for the delay. I am working on another project currently. I will add this feature within a month.

elpimous commented 1 year ago

Ohh happy for you, my friend. Wish you the best. And don't forget me/us, please 😉 I'll wait necessary time. 🙏

LifelongYuan commented 1 year ago

There is a quick way to hack: Replace the line with contactFlag[i] = leggedInterface_->getSwitchedModelReferenceManagerPtr()->getContactFlags(currentObservation_.time)[i] So the state estimator directly acquires gait schedule instead of contact sensors.

elpimous commented 1 year ago

Ohhh thanks a lot... @LifelongYuan I'll test it tonight... I'm impatient. 👍

elpimous commented 1 year ago

Seems working.. thank you so much