Table of Contents

ARCOS-Lab Humanoid Robot Simulator

Main Developer: Dr. rer. nat Federico Ruiz Ugalde

Maintainer: Daniel García Vaglio

Contributors: Javier Peralta

Description

This is a robot simulator for the ARCOS-Lab Robot. It was originally developed for TUM-Rosie robot. It simulates its two arms and fingers, force and torque sensing. It also simulates friction between an object, a table and a robot finger.

Installation instructions

 sudo apt-get install python-numpy python-scipy python-opengl python-pygame python-matplotlib python-sip python-sip-dev python-qt4-dev python-qt4 python-gtk2 python-gtk2-dev python-vtk python-pyvtk python-gtkglext1 libeigen3-dev python-yaml python-setuptools python-future python-colorlog
 sudo apt install python-numpy python-scipy python-opengl python-pygame python-matplotlib python-sip python-sip-dev python-qt4-dev python-qt4 python-gtk2 python-gtk2-dev python-vtk6 python-pyvtk python-gtkglext1 libeigen3-dev python-yaml python-setuptools python-future python-colorlog
simulator_installer.sh
#install avispy
echo "install avispy"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/avispy.git
cd avispy
make xstow_install
 
#install roboview
echo "install roboview"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/roboview.git
cd roboview
make xstow_install
 
#install cmoc
echo "install cmoc"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/cmoc.git
cd cmoc
make xstow_install
 
#install pyrovito
echo "install pyrovito"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/pyrovito.git
cd pyrovito
make xstow_install
 
#install vfl
echo "vfl"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/vfl.git
cd vfl
make xstow_install
 
#install vfclick
echo "install vfclick"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/vfclik.git
cd vfclik
make xstow_install
 
#install kdb cart cmd
echo "install kdb cart cmd"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/kbd-cart-cmd.git
cd kbd-cart-cmd
make xstow_install
 
#install arcospyu
echo "install arcospyu"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/arcospyu.git
cd arcospyu
git checkout 0.1.2
make xstow_install
 
#robot_descriptions
echo "robot_descriptions"
cd $HOME/local/src
git clone https://gitlab.com/arcoslab/robot_descriptions.git

Test the simulator

yarpserver --write
cd ~/local/src
vfclik -i lwr -i right -d robot_descriptions/arcosbot/kinematics/lwr/ -s
cd ~/local/src
vfclik -i lwr -i left -d robot_descriptions/arcosbot/kinematics/lwr/ -s
cd ~/local/src
sahand_yarp_sim -s -d -n -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py
cd ~/local/src
pyrovito -r lwr --arm_right --arm_left --hand_right --hand_left -a robot_descriptions/arcosbot/kinematics/lwr/ -d robot_descriptions/arcosbot/kinematics/sahand/
cd ~/local/src
torque_sim -r -s -a robot_descriptions/arcosbot/kinematics/lwr/ -c robot_descriptions/arcosbot/kinematics/sahand/calibration_data/finger_calibration_data.py -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py
rlwrap yarp write ... /0/torque_sim/force_in
(1 -2. 0. 0.)
(1 0. 0. 0.)
run_right.sh /0

Sliding model and control

Cancel all the programs run in the previous instructions.

Sliding model and control without robot

cd ~/local/src
pyrovito -r lwr -a robot_descriptions/tum-rosie/kinematics/lwr/ -d robot_descriptions/tum-rosie/kinematics/sahand/
planar_sliding_simple
xfinger_feeder
slider_control_simple

Sliding controller with the whole robot

vfclik -i lwr -i right -d robot_descriptions/tum-rosie/kinematics/lwr/ -s
vfclik -i lwr -i left -d robot_descriptions/tum-rosie/kinematics/lwr/ -s
sahand_yarp_sim -s -d -n -f robot_descriptions/tum-rosie/kinematics/sahand/hands_kin.py
pyrovito -r lwr --arm_right --arm_left --hand_right --hand_left -a robot_descriptions/tum-rosie/kinematics/lwr/ -d robot_descriptions/tum-rosie/kinematics/sahand/
torque_sim -s -a robot_descriptions/tum-rosie/kinematics/lwr/ -c robot_descriptions/tum-rosie/kinematics/sahand/calibration_data/finger_calibration_data.py -f robot_descriptions/tum-rosie/kinematics/sahand/hands_kin.py
planar_sliding -o cmoc/objects/sliding/objects/ice_tea_params.py
slider_control  -s -f robot_descriptions/tum-rosie/kinematics/sahand/hands_kin.py -o cmoc/objects/sliding/objects/ice_tea_params.py

DLR HIT II

WARNING: planar_sliding and slider_control will fail because of some changes that were introduced for the dual-cmap project. And it will probably remain deprecated because OMS is replacing CMOC.

Now if you want to run the simulation using the new hand (DLR HIT II):

vfclik -i lwr -i right -d robot_descriptions/arcosbot/kinematics/lwr/ -s
vfclik -i lwr -i left -d robot_descriptions/arcosbot/kinematics/lwr/ -s
sahand_yarp_sim -s -d -n -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py
pyrovito -r lwr --arm_right --arm_left --hand_right --hand_left -a robot_descriptions/arcosbot/kinematics/lwr/ -d robot_descriptions/arcosbot/kinematics/sahand/
torque_sim -s -a robot_descriptions/arcosbot/kinematics/lwr/ -c robot_descriptions/arcosbot/kinematics/sahand/calibration_data/finger_calibration_data.py -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py
planar_sliding -o cmoc/objects/sliding/objects/ice_tea_params.py
slider_control  -s -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py -o cmoc/objects/sliding/objects/ice_tea_params.py

Real robot

FRI robot communication

Installation

KRC

Check that you have FRI properly installed. In case that there are network communication problems some times there is a problem with the network card installation. The KRC has two network cards, one for Windows and one for VXworks. To be sure that the one for VXWorks is properly installed, go to control-panel→System→Hardware→Device Manager, and check that the PCI network controller is listed under “Realtime OS Devices” and not under “Network Adapters”. If it is under “Network Adapters” it means windows has “claimed” it. To reassign it to VXWorks, insert the FRI installation CD and go to INTERNAT\KRCUPD directory and run “KsNetCfg.exe”. This will install again the VXWorks network adapter card. This is usually a problem with the Intel Pro1000 GT card. Reboot and reconfigure FRI ini files.

Linux Installation

Download and compile fri stanford library. Remember to update yarp. This uses the latest API. You will have to recompile and reinstall yarp.

cd ~/local/src
git clone ssh://gitolite3@arcoslab.eie.ucr.ac.cr/fri_stanford
cd fri_stanford/Linux
mkdir -p x64/release/obj
mkdir -p x64/release/lib
mkdir -p x64/release/bin
make all_release_x64

If you want to build for debugging, first follow the normal steps and then

sudo apt-get install g++-multilib

Give suid permissions to LWR_yarp_arcos fri-yarp bridge to allow it to run using preemptive realtime scheduling:

cd ~/local/src/fri-stanford/Linux/x64/release/bin
sudo chown root: LWR_yarp_arcos
sudo chmod u+s LWR_yarp_arcos

Gravity

Please check that the gravity vector is correctly configured. After you have selected the current payload (configure→set_tool/base→tool_no/base_no), go to monitor→variable→single and introduce in “name”: $torque_tcp_est. Press shift-enter to have realtime variable updates. They should show small values No more than 5 Newtons in x,y or z. If they are big, this usually means, that either the payload is not properly selected, or that the gravity vector is incorrect.

To check the current gravitation vector monitor→variable→single in “name”: $gravitation[]. To permanently change the gravitation values, edit file :

c:\krc\roboter\krc\steu\mada\$custom.dat

At the beginning of the file you will find the variable values.

Running

The KRC has two network interfaces. One is connected to the windows operating system and the other one is connected to the QNX virtual machine for the LWR controller. In ARCOS-Lab the windows interface has the ip 192.168.3.10, the QNX interface has the ip 192.168.2.250.

If this configuration is wrong in the KRC you can fix it by:

[Boot]
Bootline=elPci(0,1)pc:vxworks h=192.0.1.2 b=192.0.1.1 e=192.168.2.250 u=target pw=vxworks
[DLRRC]
TIMEOUT=25
IMMEDIATE_STARTUP=1
FRIHOST=192.168.2.113
FRISOCK=49938,0
FRIKEY=(use provided key)

We had troubles using an Intel Giga network controller. The 3Com one works correctly. To check that windows is properly detecting and using the FRI network controller, go to the windows “Device Manager” and check that the 3Com network controller is assigned as part of a “Realtime OS Devices” section and not inside “Network adapters” section.

Connecting your computer to the FRI network

The host computer (your computer or the computer running the FRI-yarp bridge) must have the following ip address: 192.168.2.113. This is configured in some .ini file in the KRC.

sudo ifconfig eth0 up
sudo ifconfig eth0:0 192.168.2.113 netmask 255.255.255.0
ping 192.168.2.250
#!/bin/bash

if [ $1 = up ]
then
  echo "Disabling previous wired network configuration"
  sudo ifdown eth0
  sleep 2
  sudo ifdown eth0
  sleep 2
  echo "Turning wired network on"
  sudo ifconfig eth0 0.0.0.0 up
  echo "Kuka FRI network"
  sudo ifconfig eth0:0 192.168.2.113 netmask 255.255.255.0
  echo "Kuka KRC windows network"
  sudo ifconfig eth0:1 192.168.3.113 netmask 255.255.255.0
  echo "Wessling robotics Hand network"
  sudo ifconfig eth0:2 192.168.200.10 netmask 255.255.255.0
  echo "Checking communication with robot parts"
  ping -i 0.3 -w 3 -c 5 192.168.2.250
  if [ $? != 0 ]
  then
      echo "Comunication error with Kuka FRI, check FRI network"
      exit 1
  fi
  ping -i 0.3 -w 3 -c 5 192.168.3.10
  if [ $? != 0 ]
  then
      echo "Comunication error with Kuka KRC windows, check Kuka KRC windows network"
      exit 1
  fi
  ping -i 0.3 -w 3 -c 5 192.168.200.1
  if [ $? != 0 ]
  then
      echo "Comunication error with Wessling robotics Hand, check Hand network"
      exit 1
  fi

fi
if [ $1 = down ]
then
  echo "Turning all robot networks down"
  echo "Wessling robotics Hand network"
  sudo ifconfig eth0:2 down
  echo "Kuka KRC windows network"
  sudo ifconfig eth0:1 down
  echo "Kuka FRI network"
  sudo ifconfig eth0:0 down
  echo "Turning wired network off"
  sudo ifconfig eth0 down
fi

Connecting your computer with the KRC windows operating system

You can also connect to the same network of the KRC windows OS. This may be useful for editing or copying files:

sudo ifconfig eth0:1 192.168.3.113 netmask 255.255.255.0
ping 192.168.3.10

Access the KRC windows files in your computer

mkdir -p /mnt/krc
sudo mount -t cifs //192.168.3.10/krc /mnt/krc/ -o user=user,vers=1.0

Now you can access the KRC windows files in your linux computer.

Running the FRI-yarp bridge

cd ~/local/src/fri_stanford/Linux/x64/release/bin
./LWR_yarp_arcos
cd ~/local/src/fri_stanford/Linux/x64/release/bin
sudo su
cd
export HOME=/home/my_user
. /home/my_user/.bashrc
export HOME=/root/
cd -
./LWR_yarp_arcos

Running the FRI KRC KRL client controller code

Restarting in case of bad communication quality

Starting the vfclik system for the real robot (AAMAS 2019 experiments). Only runs on the right arm/hand

arcospyu avispy cmoc kbd-cart-cmd orocos-kdl pyrovito robot_descriptions vfclik vfl
fri-stanford hand-code
ced5964df3e730fe5d578e044277f69665b95a1f

Running the ARM software

cd ~/local/src
vfclik -n /arcosbot-real -r lwr -i right -d robot_descriptions/arcosbot/kinematics/lwr/
cd ~/local/src
pyrovito -n /arcosbot-real -r lwr --arm_right --hand_right -a robot_descriptions/arcosbot/kinematics/lwr/ -d robot_descriptions/arcosbot/kinematics/sahand/
cd ~/local/src
bar_vis
yarp connect /arcosbot-real/lwr/right/debug/qdist /bar_vis/bar/in
run_right.sh "/arcosbot-real"
yarp write ...  /arcosbot-real/lwr/right/nullspace/control

In this console you can write nullspace speed movements. Try small numbers like 0.1 first.

Running the HAND acquisition and force estimation

cd ~/local/src/hand-code/hand_yarp
./python/wessling_hand/start_ard.py 
cd ~/local/src
sahand_yarp_sim -b /arcosbot-real -r -d -n -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py
cd ~/local/src
torque_sim -b /arcosbot-real -r -a robot_descriptions/arcosbot/kinematics/lwr/ -c robot_descriptions/arcosbot/kinematics/sahand/calibration_data/finger_calibration_data.py -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py

Hand torque sensor calibration

cd ~/local/src
sahand_yarp_sim -b /arcosbot-real -r -d -n -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py
cd ~/local/src
torque_sim -b /arcosbot-real -r -a robot_descriptions/arcosbot/kinematics/lwr/ -c robot_descriptions/arcosbot/kinematics/sahand/calibration_data/finger_calibration_data.py -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py
cd ~/local/src/hand-code/hand_yarp/python/wessling_hand
./hand_calibration.py -b /arcosbot-real -c ~/local/src/robot_descriptions/arcosbot/kinematics/sahand/calibration_data/finger_calibration_data.py -f ~/local/src/robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py -a ~/local/src/robot_descriptions/arcosbot/kinematics/lwr/

Camera calibration

The usual steps for setting up a system with a camera with marker detection consists:

Install ROS1 modules
git clone git@git.arcoslab.org:humanoid-software/oms-cylinder.git
roslaunch oms_launcher rs_camera.launch
Calibrate camera intrinsics

http://wiki.ros.org/camera_calibration

Run a arm_base-to-camera_base calibration
https://github.com/Jmeyer1292/robot_cal_tools
Set a launch file for running the camera module, together with a rectification module, together with an static transform representing the arm_base-to-camera_base transform.
oms_launcher_marker90.launch
ar_oms_cylinder_marker90.launch
Ros to yarp bridge
cd ar_pose_marker_yarp_bridge/scripts
./ros_to_yarp_box_pose.py -w ~/local/src/robot_descriptions/arcosbot/perception/webcam_calibration_values.py -o ~/local/src/cmoc/objects/sliding/objects/object_params.py

Finger tip pushing calibration

Once you followed the #hand_torque_sensor_calibration, you will have one or more fingers for exerting forces against objects. Now we will assume that you will use one finger to push an object. Once you selected the particular finger you will need to find a particular hand orientation to push the object to avoid table crashes or other parts of the hand to crash against the object itself. A trick to get this easier is to glue a marker to the fingertip of the selected pushing finger. Then orient the hand (using run_right.sh “/arcosbot-real”) in the desired pushing orientation. Command the fingers to a finger pushing configuration. Glue the marker to the finger tip. Adjust the marker such that it is vertical in orientation (to match the markers that are glued to other objects). Get the current marker pose (To_m), get the current finger global pose (To_f), calculate the fingertip-to-marker homo transform (Tt_m=((To_t)^-1)*To_m). Use this transform in the robot_descriptions/arcosbot/perception/webcam_calibration_values.py file with the rel_pose_marker_finger variable.

Step-by-step instructions:

cd ar_pose_marker_yarp_bridge/scripts
./ros_to_yarp_box_pose.py -w ~/local/src/robot_descriptions/arcosbot/perception/webcam_calibration_values.py -o ~/local/src/cmoc/objects/sliding/objects/object_params.py -f
cd local/src/cmoc/objects/sliding/scripts/
./exploration.py -n /arcosbot-real -c ~/local/src/robot_descriptions/arcosbot/kinematics/sahand/calibration_data/finger_calibration_data.py -o ~/local/src/cmoc/objects/sliding/objects/object_params.py -f ~/local/src/robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py -w ~/local/src/robot_descriptions/arcosbot/perception/webcam_calibration_values.py
Getting initial object position
Box global pose [[ 0.99903308  0.00634678 -0.04350436  0.63601302]
 [-0.00841706  0.99883239 -0.04757109  0.25734383]
 [ 0.04315164  0.04789128  0.99792002  0.85763204]
 [ 0.          0.          0.          1.        ]]
If right, press "y"
yarp read ... /arcosbot-real/marker/object_pos:o
yarp read ... /arcosbot-real/lwr/right/vectorField/pose

Exploring for the object parameters

./exploration.py -n /arcosbot-real -c ~/local/src/robot_descriptions/arcosbot/kinematics/sahand/calibration_data/finger_calibration_data.py -o ~/local/src/cmoc/objects/sliding/objects/object_params.py -f ~/local/src/robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py -w ~/local/src/robot_descriptions/arcosbot/perception/webcam_calibration_values.py

Running in simulation the same conf as in real life

This part of the tutorial is useful when you want to run the simulator using the same hardware and configuration that is available right now in “real life”. Make sure to use the correct tag as stated in the Starting the vfclik system for the real robot (ROBIO 2019 experiments). Only runs on the right arm/hand section. Each line of the following code block should be run in a separate terminal at ~/local/src/.

vfclik -s -n /arcosbot-real -i lwr -i right -d robot_descriptions/arcosbot/kinematics/lwr/
pyrovito -n /arcosbot-real -r lwr --arm_right --hand_right -a robot_descriptions/arcosbot/kinematics/lwr/ -d robot_descriptions/arcosbot/kinematics/sahand/
sahand_yarp_sim -b /arcosbot-real -r -d -n -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py -s
torque_sim -b /arcosbot-real -r -a robot_descriptions/arcosbot/kinematics/lwr/ -c robot_descriptions/arcosbot/kinematics/sahand/calibration_data/finger_calibration_data.py -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py -s
run_right.sh "/arcosbot-real"

Sending commands to the Arcosbot server

If the arcosbot server is running the system for using the robot, then it is possible to just send commands to the server using YARP.

yarp detect --write

Now YARP will use the remote server. You can send basic commands to the robot using kbd commands.

run_right.sh "/arcosbot-real"

Common Problems

If you encounter an X server error while executing the simulator, check the following:

If you encounter errors with multiprocessing. Add the following line to /etc/fstab

none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0

And then execute:

sudo mount /dev/shm

Running the Dual Capability Map System

* Open a terminal and execute Yarp:

yarpserver start

* In another console execute vfclik for right arm:

cd ~/local/src/
vfclik -i lwr -i right -d robot_descriptions/arcosbot/kinematics/lwr/ -s

* In another console execute vfclik for left arm:

cd ~/local/src/
vfclik -i lwr -i left -d robot_descriptions/arcosbot/kinematics/lwr/ -s

* In another console execute hands simulator:

cd ~/local/src/
sahand_yarp_sim -s -d -n -f robot_descriptions/arcosbot/kinematics/sahand/hands_kin.py

* In another console execute roboviewer visualizator:

cd ~/local/src/
pyrovito -r lwr --arm_right --arm_left --hand_right --hand_left -a robot_descriptions/arcosbot/kinematics/lwr/ -d robot_descriptions/arcosbot/kinematics/sahand/

Yarp port descriptions

Module: Bridge

weights port

Module: vectorField

weight port

Module: Object feeder

object port

Module: joint controller

reference port

Module: Distance monitor

Distance out port

Module: Debug module

Joint Distance port

Module: Nullspace

Control port

Changing robot base position/orientation

Changes in KRC

c:\krc\roboter\krc\steu\mada\$custom.dat

Changes in Linux software

Review:

VFClik initial joint and frame positions

robot_descriptions/arcosbot/kinematics/lwr/config-lwr-right.py