-
Notifications
You must be signed in to change notification settings - Fork 43
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
Create model integrating the YOGA++ controller with the dynamics with contacts simulator from matlab-whole-body-simulator #121
Comments
As described in https://github.com/dic-iit/element_software-engineering/issues/24, this consists in replacing the Gazebo target by the library blocks "RobotDynWithContacts", "IMU" and "robot visualizer" from
|
The new Simulink model Notes on particular changes... Robot model specific to the simulation, distinct from the model used by the controllerThis allows to have parameters specific to the simulation, like:
Neck joints and option
|
Simulation run fails at the very beginning: This is due to a known problem, not fully characterized, nor fully fixed, with the QP block (WBT block implementing the qpOASES solver): https://github.com/dic-iit/element_ironcub-control/issues/164#issuecomment-821027420. Trying a similar fix... using QP interface with constraints lower bound input "lbA". Set lbA=-Inf. The workaround fixed the problem! |
ping @traversaro , @gabrielenava |
The cause is most probably the motor reflected inertia: I left it at 0. I have to set the proper values and retest. |
given the critical failure I suggest, in case you did not do it yet, to perform first a balancing demo instead of the Yoga, in order to reduce the complexity and isolate problems related to the simulator and problem related to gain tuning. There are several way to skip the yoga demo, I usually set to |
Yes @gabrielenava , indeed it was my intention in my next step. Thanks! Well, with the reflected inertia it improved, and it fails later, after lifting the right foot from the ground. The jointss start jiggling. I also remembered that the simulator is unstable if we compensate the friction completely, which is the case here since it's a "perfect" torque control. I'm going to retest with friction. And it still makes sense to test only the balancing for starting. I'll follow your suggestion on the |
Reflected motor inertias and friction torques implemented... Reflected motor inertiasRefer to ami-iit/matlab-whole-body-simulator#9 for the theory and the implementation in the core block RobotDynWithContacts from There is no motor nor joint model in the simulator sub-system in the model Join friction torquesThe friction torques are computed from the joint velocities and a simple viscous friction model.
The new joint torque inputs to the block RobotDynWithContacts are computed as follows: Where For now I'm giving a try with same friction 0.5 Nm/(rad/s) for all joints. |
Tests 1 to 3
Test 1
=> Simulation diverges approx. after 1s. Test 2
=> Simulation diverges approx. after 13s. Test 3
=> Simulation stable over 1mn. Tests 4 to 7
Test 4, 5, 6
=> As soon as it lifts the feet, the ankle starts oscillating, and after 5s the whole body. Test 7
=> More stable for the first 5s then same instability and divergence. yogapp_failing_test_7_more_stable.mp4At this point, activating the reflected inertia on the controller side does not improve the behavior. |
In the previous tests we are also exceeding the joint limits, specially on the knee, going through a singular position. In the video below (side view of the test 7), we can see that the oscillations seem to begin when the knee is fully stretched. yogapp_failing_test_7_side_view.mp4If possible, I'll tune the center of mass to be lower, for avoiding the legs to stress so much and thus avoid the singular position of the knee. |
…ualizer at 10ms - Tuning tests 1 to 3 (Refer to #121) - Tuning tests 4,5,6 Controller Motor reflected inertia ON/OFF / Harmonic Drive inertia ON/OFF / Coupling ON/OFF Simulator Motor reflected inertia ON Simulator Friction = 0.2
@gabrielenava , while I'm doing my own intuitive tuning, could you give me a quick recap of the methodology you follow for tuning the YOGA? Typically the parameters you adjust most often in |
Checks done on the controller & simulation outputs
Test 8: Skip YOGA (support foot switching only)
Mass matrix condition number ~6700 (Motor Reflected Inertia OFF)Mass matrix condition number ~420 (Motor Reflected Inertia ON)Skip Yoga visualization
|
|
Test 9: Full Yoga with support on the left foot(commit f238595)
At this point, the YOGA with support on left foot works and is stable. The robot falls when attempting the second YOGA on the right foot. yogapp_test_9_onLeftFootPASS_onRightFootFAIL_lightFormat.mp4Thanks @gabrielenava for your help. As you suggested, I increased the CoM and postural gains. the full critical damping gains were causing the robot to lose balance and fall, so I've used 1/2 of the critical damping. |
It's probably due to the Postural gain scheduling. For some reason, we're not getting symmetrical gains on the left and right ankles, and we can notice in the video that the robot falls apparently because the right ankle does not keep it's position as if the torque was insufficient: More tomorrow... |
I wonder what happens if you perform the Yoga only on the left foot, and when the Yoga finishes you just remain into two feet balancing state (it is this option in the Yoga config file: https://github.com/robotology/whole-body-controllers/blob/master/controllers/floating-base-balancing-torque-control/app/robots/iCubGazeboV2_5/configStateMachine.m#L57). If the robot can actually come back on two feet and balance, maybe the failure is a matter of timing in the state machine (the robot switches too early on right foot balancing). Another test could be to perform the Yoga on the right foot only and check if the robot behaviour is symmetrical w.r.t. the left (there may be differences in gains and references, the states of the state machine are different for left and right Yoga). Here the option to run the Yoga on right foot only: https://github.com/robotology/whole-body-controllers/blob/master/controllers/floating-base-balancing-torque-control/app/robots/iCubGazeboV2_5/configStateMachine.m#L56 |
Sure, I'll be trying that today. Also, for meeting the deadline, we can consider just doing the YOGA on the left foot. |
The YOGA on left foot only works. In the plot below, we're running the YOGA left foot only and can see the ankle roll gain decrease to
Indeed, we can see in the plot of the leg gains (#121 (comment)) the same behavior: the ankle gain decreases along the state 7. Since in that case we were doing also YOGA right foot, the gain starts increasing again as soon as we switch to state 8. But as @gabrielenava mentioned, there's not enough time for the gain to rise up again to 100 (the gain scheduled in state 8). Side note: I don't see why the ankle gains were set so low in state 7 by the way. For ruling out or confirming the problem with the gains or timing, I increase the balancing time |
After further analysis, and after doing some adjustments that improved the behavior, avoiding some QP failures that were occurring when shifting the weight to the right foot, the robot is still falling. At this point it's better to proceed with the PR with only the YOGA left foot, and solve this problem later. |
It make sense! |
For the record, this is the last PR to go, for completing the Epic https://github.com/dic-iit/element_software-engineering/issues/24 (apart from a bit of documentation). |
The fix of the YOGA starting on the right foot shall be tracked in #127. Closing this issue. |
Moved from ami-iit/matlab-whole-body-simulator#32:
We wish to implement a Simulink model which controls a humanoid robot (iCub) in performing a dynamic trajectory while balancing: the YOGA++. For that purpose, the model would integrate the YOGA++ controller with the whole-body simulator from
matlab-whole-body-simulator
.Recap of follow-up issues
Config.EMERGENCY_STOP_WITH_ENCODER_SPIKES
by a warning.The text was updated successfully, but these errors were encountered: