Skip to content

Commit

Permalink
Add the documentation to run the test with pixi
Browse files Browse the repository at this point in the history
  • Loading branch information
martinaxgloria authored and Nicogene committed Mar 11, 2024
1 parent 24acdfb commit f815cf2
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 18 deletions.
2 changes: 1 addition & 1 deletion set_path.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export CMAKE_INSTALL_PREFIX=$CONDA_PREFIX
export YARP_DATA_DIRS=$CMAKE_INSTALL_PREFIX/share/yarp:$CMAKE_INSTALL_PREFIX/share/iCub:$PIXI_PROJECT_ROOT/suites
export LD_LIBRARY_PATH=$CMAKE_INSTALL_PREFIX/lib/robottestingframework:$PIXI_PROJECT_ROOT/.build/plugins
export CMAKE_PREFIX_PATH=$CONDA_PREFIX:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=$CONDA_PREFIX
95 changes: 95 additions & 0 deletions src/imu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
IMU orientation test
====================

## Prerequisites

If you want to test multiple IMUs at once, the robot must expose in its `yarprobotinterface` configuration file a `multipleanalogsensorsserver` that publishes the orientation measurements for all of available sensors, with a `prefix` that matches exactly the `port` parameter of the test (the default one is `${portprefix}/alljoints/inertials`).

An example of `alljoints-inertials_wrapper.xml` for iCubV2_* models:

```sh
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE devices PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<device xmlns:xi="http://www.w3.org/2001/XInclude" name="alljoints-inertials_wrapper" type="multipleanalogsensorsserver">
<param name="period"> 10 </param>
<param name="name"> ${portprefix}/alljoints/inertials </param>

<action phase="startup" level="10" type="attach">
<paramlist name="networks">
<elem name="FirstStrain"> alljoints-inertials_remapper </elem>
</paramlist>
</action>

<action phase="shutdown" level="15" type="detach" />
</device>
```

and `alljoints-inertials_remapper.xml`:

```sh
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE devices PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">


<device xmlns:xi="http://www.w3.org/2001/XInclude" name="alljoints-inertials_remapper" type="multipleanalogsensorsremapper">
<param name="OrientationSensorsNames">
(l_arm_ft r_arm_ft head_imu_0)
</param>
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="head_imu"> head_inertial_hardware_device </elem>
<elem name="left_arm_imu"> left_arm_inertial_hardware_device </elem>
<elem name="right_arm_imu"> right_arm_inertial_hardware_device </elem>
</paramlist>
</action>

<action phase="shutdown" level="20" type="detach" />
</device>

```

## Usage

There are essentially two methods to install and run the IMU orientation test, which are going to be described in the following sections. In both cases, after launching the test, a .mat file containing the relevant measurements involved in the test will be generated.

### robotology-superbuild

If you have installed `icub-tests` as a part of the `robotology superbuild` framework with the [Robot Testing profile](https://github.com/robotology/robotology-superbuild/blob/master/doc/cmake-options.md#robot-testing) activation, i.e. by enabling the `ROBOTOLOGY_ENABLE_ROBOT_TESTING` CMake option of the superbuild, this test, like the others, is already available.

In this case, after compiling and being sure that `yarpserver` is up, you can run:

```sh
cd robotology-superbuild/src/icub-tests
robottestingframework-testrunner --suite suites/imu.xml
```

Otherwise, if you want to launch the test in a simulation environment, in a shell open a `gazebo` environment and import, for example, your iCub model. After that, open a separated shell, and:

```sh
#set YARP_ROBOT_NAME env variable with the name of the model you imported in gazebo
#example:
export YARP_ROBOT_NAME=iCubGazeboV2_7
cd robotology-superbuild/src/icub-tests
robottestingframework-testrunner --suite suites/imu-icubGazeboSim.xml
```

### pixi

If you want to run the test without depending on the whole robotology-superbuild, you can use `pixi`. First of all, be sure to have [`pixi`](https://pixi.sh/#installation) installed. Then, clone `icub-tests` and run the test as a pixi task:

```sh
git clone https://github.com/robotology/icub-tests
cd icub-tests
pixi run imu_test
```

In simulation, instead, import your model in `gazebo` and then run:

```sh
#set YARP_ROBOT_NAME env variable with the name of the model you imported in gazebo
#example:
export YARP_ROBOT_NAME=iCubGazeboV2_7
cd icub-tests
pixi run imu_sim_test
```
26 changes: 11 additions & 15 deletions src/imu/imu.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,19 @@
* It takes as input the urdf of the robot and make a comparison between the expected values retrieved from the forward kinematics and the ones read from the IMU itself.
* The test involves the movements of the joints belonging to the part on which the sensors are mounted.
*
* You can find the parameters involved in the test in suites/contexts/icub/test_imu.ini file.
* To run the test, you have to install <a href="https://pixi.sh/latest/#installation">pixi</a> and then, after cloning this repo, you can run:
* You can find the parameters involved in the test in the following table:
*
* pixi run imu_test
* | Parameter name | Type | Required | Description | Notes |
* |:------------------:|:------------------:|:--------:|:-----------:|:-----:|
* | robot | string | Yes | The name of the robot. | e.g. icub |
* | model | string | Yes | The name of the robot model. | e.g. model.urdf |
* | port | string | Yes | The name of the port streaming IMU data. | e.g. /icub/alljoints/inertials |
* | remoteControlBoards| vector of string | Yes | The list of the controlboards to open. | e.g. ("torso", "head") |
* | axesNames | vector of string | Yes | The list of the controlled joints. | e.g. ("torso_pitch", "torso_roll", "torso_yaw", "neck_pitch", "neck_roll", "neck_yaw") |
* | sensorsList | vector of string | Yes | The list of the sensors to be tested. | e.g. ("head_imu_0", "l_arm_ft") or ("all")|
* | maxError | double | Yes | The tolerance on the error. | |
*
* This will compile the dependencies, launch the test and, at the end, a .mat file is generated containing the relevant measurements of the test.
*
* Accepts the following parameters:
* | Parameter name | Type | Units | Default Value | Required | Description | Notes |
* |:------------------:|:------------------:|:-----:|:-------------:|:--------:|:-----------:|:-----:|
* | robot | string | - | - | Yes | The name of the robot. | e.g. icub |
* | model | string | - | - | Yes | The name of the robot model. | e.g. model.urdf |
* | port | string | - | - | Yes | The name of the port streaming IMU data. | e.g. /icub/head/inertials |
* | remoteControlBoards| vector of string | - | - | Yes | The list of the controlboards to open. | e.g. ("torso", "head") |
* | axesNames | vector of string | - | - | Yes | The list of the controlled joints. | e.g. ("torso_pitch", "torso_roll", "torso_yaw", "neck_pitch", "neck_roll", "neck_yaw") |
* | sensorsList | vector of string | - | - | Yes | The list of the sensors to be tested | e.g. ("head_imu_0", "l_arm_ft") or ("all)|
* | maxError | double | - | - | Yes | The tolerance on the error. | |
* Further instructions about how to install, configure and run the test can be found in the <a href="http://robotology.github.io/icub-tests/doxygen/doc/html/pages.html">related page</a>.
*/

class Imu : public yarp::robottestingframework::TestCase {
Expand Down
3 changes: 1 addition & 2 deletions suites/contexts/icub/test_imu.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ model model.urdf
port /${robotname}/alljoints/inertials
remoteControlBoards ("torso", "head", "left_arm", "right_arm")
axesNames ("torso_pitch", "torso_roll", "torso_yaw", "neck_pitch", "neck_roll", "neck_yaw", "l_shoulder_pitch", "l_shoulder_roll", "l_shoulder_yaw", "r_shoulder_pitch", "r_shoulder_roll", "r_shoulder_yaw")
; sensorsList ("head_imu_0", "l_arm_ft", "r_arm_ft")
sensorsList ("all")
sensorsList ("all")
maxError 0.1

0 comments on commit f815cf2

Please sign in to comment.