Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 4.8 KB

File metadata and controls

75 lines (52 loc) · 4.8 KB

Module description

This module implements the same torque controller described in floating-base-balancing-torque-control, the block "MOMENTUM BASED TORQUE CONTROL", but instead of controlling the real iCub robot or the model on Gazebo, it is integrated with the robot simulator from matlab-whole-body-simulator.

In the above diagram, signals and blocks sampling times are identified by colors

  • red: 1 ms
  • pink: constant
  • green: 10 ms

More precisely:

  • The controller "MOMENTUM BASED TORQUE CONTROL" feeds the joint torques to the robot dynamics simulator "Robot Simulator" through a memory block for avoiding algebraic loops.
  • The "Robot Simulator" simulates the robot dynamics, handling the contacts of the feet with the ground. This sub-system provides the inputs required by the controller:
    • joint positions
    • joint velocities
    • joint accelerations
    • left foot wrench
    • right foot wrench
    • IMU measurements
  • The "Robot Visualizer" allows to visualize the robot. It avoids using Gazebo as a visualizer. As a result, the overall procedure for running the simulation is simpler (no need to run Yarp nor Gazebo, nor synchronize them with Matlab).

The "Robot Simulator" has its own "Config" block, for a robot configuration specific to the simulation, and is composed of three other blocks:

  • The "RobotDynWithContacts", actual simulator core, simulates the robot dynamics and provides all the robot kinematic and dynamic quantities.
  • The "IMU" emulates the sensor outputs from the floating base state and linear acceleration.
  • The "Friction Model" block implements a simple viscous friction model, function of the joints velocities and desired torques.

"RobotDynWithContacts", "IMU" and "RobotVisualizer" blocks are library blocks imported from matlab-whole-body-simulator. Their parameters are set through their respective masks. For further details on the "RobotDynWithContacts" configuration, refer to https://github.com/dic-iit/matlab-whole-body-simulator/blob/master/README.md.

Compatibility

The folder contains the Simulink model torqueControlBalancingWithSimu.mdl, which is generated by using Matlab R2020b.

Supported robots

Currently, the only supported robot model is iCubGazeboV2_5 which has the proper inertia tuning (for the very small and light links within the shoulders, hips, etc).

Module details

How to run the demo

You don't need any module external module running outside of Matlab.

For running the simulation from the source module (for developpers wishing to perform any modification), follow the few steps below:

  1. Set the YARP_ROBOT_NAME environment variable to the desired model. The default and only currently supported model is iCubGazeboV2_5. There is no direct link with Gazebo. This model is suitable for the matlab-whole-body-simulator because of the modified inertia of the intermediate small and light links within the 3-DoF joints (shoulder pitch-roll-yaw, hip pitch-roll-yaw, etc), tuned for stabilising the dynamics of the simulation.

    > setenv(`YARP_ROBOT_NAME`,`iCubGazeboV2_5`)
    
  2. Verify that the target robot model is available. You can check if the controller is targeting the correct robot model by typing on the Matlab command line:

    system('yarp resource --find model.urdf')
    

    then, check that the path and the model name are correct.

  3. Change the working directory to the parent folder of the controller model.

  4. Open the Simulink model torqueControlBalancingWithSimu.mdl.

  5. Run the model.

For running the simulation from the installed module (e.g. in case of a user, without any experience in simulation nor control, just trying the simulator for the first time), skip steps 3. and 4. and execute instead:

>> floatingBaseBalancingTorqueControlWithSimulator.torqueControlBalancingWithSimu

Configuration file

At start, the module calls the initialization file initTorqueControlBalancingWithSimu.m. Once opened, this file contains some configuration variables. Please follow the instruction inside the script to properly configure your simulation.

Robot and demo specific configurations

The gains and references for a specific robot (specified by the variable YARP_ROBOT_NAME) or a specific demo can be found in the folder app/robots/YARP_ROBOT_NAME.