Skip to content

icub-tech-iit/ergocub-gazebo-simulations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ergocub-gazebo-simulations

robots

Repository that contains some testing utilities for the ergocub project.

This repo contains a gazebo model, starting from iCub3, and some scripts that can easily modify it and test it in diverse scenarios. The goal of this repo is to gain knowledge about which is the best configuration for the ergoCub in terms of limb length, mass, etc.

Maintained by:

Installation using dependencies compiled from sources

Requirements:

Installation:

  • Clone this repo and create a build directory on it:
git clone https://github.com/icub-tech-iit/ergocub-gazebo-simulations.git
cd ergocub-gazebo-simulations
mkdir build
cd build
  • Then use ccmake to specify the directory where you installed robotology-superbuild:
ccmake ..
CMAKE_INSTALL_PREFIX             <directory-where-you-downloaded-robotology-superbuild>/build/install
  • You can now proceed to build:
make install -j4

You should now see three new models when you open gazebo from the terminal:

newgazebobots

Finally, add export YARP_ROBOT_NAME=stickBot in your .bashrc.

Installation using dependencies compiled from binary

If you want to use ergocub-gazebo-simulations and you want to install gazebo-yarp-plugins and other dependencies from conda binaries, you can first of all create a new environment (you can skip this step if you already have an environment you want to use):

mamba create -n ergocubsim

Then, you can activate the environment and install the dependencies:

mamba activate ergocubsim
mamba install -c conda-forge -c robotology robotology-distro yarp icub-models gazebo-yarp-plugins gazebo whole-body-controllers walking-controllers cmake ninja whole-body-estimators

Clone this repo and create a build directory on it:

git clone https://github.com/icub-tech-iit/ergocub-gazebo-simulations.git
cd ergocub-gazebo-simulations
mkdir build
cd build

After that, you can install the repo with these commands on Windows:

cmake -GNinja -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ..
ninja install

and with this command on Linux/macOS:

cmake -GNinja -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX ..
ninja install

You should now see three new models when you open gazebo from the terminal:

newgazebobots

Finally, set the YARP_ROBOT_NAME in your environment to stickBot, via the command:

conda env config vars set YARP_ROBOT_NAME=stickBot

After this, make sure that you re-activate your conda environment before using the simulator and the software that use the simulator.

Usage

Changing robot characteristics

cd scripts
./modify_robot.py # [-c {PATH}] [-r]

The modify_robot script changes the dimensions of the stickbot according to a configuration file. It also performs the installation step, so gazebo gets updated with the newest robot right away.

Flags:

  • -c/--config {PATH} Path of the configuration file, default is the conf.ini file inside scripts.
  • -r/--reset Setting this flag returns the robot to its latest version from git (by using git-checkout). This flag is prioritized over the configuration file.

The configuration file

The conf.ini file is a simple configuration file specifying the elements to modify:

[left_arm]
dimension = 0.65
radius = 0.45
density_scale = 1.5

[r_lower_leg]
dimension = 1.5

The upper section (the one inside []) specifies the element to modify, options include torso, right_arm, left_arm, right_leg, left_leg, arms, legs, all, or the name of an individual link (Caution: if a link and its respective limb are both specified, the changes could accumulate!). Sections with other names will be ignored.

For any element you can specify dimension, mass, density, and radius, which will set the specific property for all the valid links. If you want relative scaling you can instead add the _scale suffix and the factor to multiply to the original value. If a config section includes both an absolute and a scaling modifier the absolute one takes precedence. Mass modifications take precendence over density.

Holding Box Experiment

This sandbox uses the worldInterface gazebo yarp plugin. To run it:

cd experiments/hold_box
./hold_box.sh

This experiment creates a StickBot in gazebo with its hands open. Then, a box spawns on top and the robot holds it:

ergocub_first_test.mp4

Instead of closing every window that opens after the test, you can call the cleanup script:

./cleanup.sh

To change the properties of the box being spawned you can call the modify_box script:

./modify_box.py # [-p {X Y Z}] [-d {D W H}] [-m {MASS}] [-r]

After running the test, a new directory called telemetry_data will appear, use the plotTelemetry.m script in MATLAB to plot the results for the specific joints you need:

hold_box_matlab_plot

Flags:

  • -p/--position The spawning position of the box, inputted as three numbers representing X, Y and Z coordinates
  • -d/--dimensions The dimensions of the box, inputted as three numbers representing its depth, width and height
  • -m/--mass The mass of the box as a float
  • -r/--reset Setting this flag returns the box to its latest version from git (by using git-checkout). This flag is prioritized over all other flags.

ergocub-holding-bigger-box

Gym-like Movements Experiment

This experiment attaches weights to the stickBot and makes it perform gym-like motions, in order to isolate (to the stickBot's best abilities) the effort to single joints. This sandbox uses the worldInterface gazebo yarp plugin, then before running the script you must append to GAZEBO_MODEL_PATH the /my/workspace/robotology-superbuild/src/GazeboYARPPlugins/tutorial/model path. Then:

cd experiments/gym
./gym_session.sh # {curls lateral_raises front_raises}

The three possible experiments are the following:

Name Stressed Joint Example
curls r_elbow, l_elbow curl
front_raises r_shoulder_pitch, l_shoulder_pitch front-raise
lateral_raises r_shoulder_roll, l_shoulder_roll lateral-raise
twists torso_yaw twists
bends torso_roll bends
extensions torso_pitch extensions

After running the test, a new directory called telemetry_data will appear, use the plotTelemetry.m script in MATLAB to plot the results for the specific joints you need:

lateral_raise_116stickbot_7kg_torque

Walking and Balancing Experiment

These experiments implement walking and balancing, to stress the leg joints.

For running the walking experiment, just run the go_for_a_walk.sh script.

cd experiments/walking
./go_for_a_walk.sh

Gazebo will spawn, and the robot will walk like so:

stickbot-walk.mp4

For this to work, WalkingModule needs to be installed in the system.

It is important to mention that the behavior can be unreliable, and the robot may some times fall. For this reason, the script runs Gazebo with a GUI (unlike the other experiments). This way one can run the experiment several times until a successful walk is achieved. Once the robot walks properly, you will have the data available.

The balancing experiment is ran using whole-body-controllers. Particularly, the floating-base-balancing-torque-control demo. You should launch Gazebo, spawn a stickbot and then run the simulink model. From there, you can use the plotTelemetry.m matlab script to visualize the data in the joints of interest.

stickbot-balancing.mp4

Feedback and Collaboration

For bugs and feature requests feel free to submit an issue and we will look into it.