Table of Contents
Motor simulator for a robotic high efficient-low cost joint
Coordinator: Mauricio Rodríguez Calvo
Description
This tutorial describes the necessary steps to install a motor simulator used to investigate about a robotic high efficient-low cost joint. It simulates the behavior of an electrical motor while moving a one degree free joint when receives a current define by the user. It shows two comparative graphs indicating the actual motor joint position in real time.
Installation Section
- This simulator requires similar packages and tools than the objective_manipulation_robot_simulator.
- If you have Debian Jessie stable you can install the package below. Else, Install debian in a chroot Debian Unstable inside a Chroot. Is important to change the name of the motor simulator if you have any other simulator that uses a chroot or you are thinking of installing another simulator with this characteristic, since having more than one chroot could represent a problem without any good name and identification.
debootstrap --arch amd64 sid /var/sid-amd64-chroot http://snapshot.debian.org/archive/debian/20150918T095308Z
* Now is necessary to change the bash file with this script for the necessary system directories.
#!/bin/bash CHROOT_DIR=/var CHROOT_NAME=`basename $0 .sh` DIS_NUM=`echo $DISPLAY` if [ ! -e /var/run/$CHROOT_NAME ] then sudo touch /var/run/$CHROOT_NAME sudo bash -c "echo 1 > /var/run/$CHROOT_NAME" else sudo bash -c "echo `expr 1 + \`cat /var/run/$CHROOT_NAME\`` > /var/run/$CHROOT_NAME" fi if [ `cat /var/run/$CHROOT_NAME` -eq 1 ] then echo "First chroot invocation. Mounting host system directories" sudo mkdir -p $CHROOT_DIR/$CHROOT_NAME/hostfs #mount -o bind /home/ $CHROOT_DIR/$CHROOT_NAME/home sudo mount proc -t proc $CHROOT_DIR/$CHROOT_NAME/proc sudo mount -o bind /dev $CHROOT_DIR/$CHROOT_NAME/dev sudo mount sys -t sysfs $CHROOT_DIR/$CHROOT_NAME/sys sudo mount none -t devpts $CHROOT_DIR/$CHROOT_NAME/dev/pts sudo mount -o bind / $CHROOT_DIR/$CHROOT_NAME/hostfs sudo mount -o bind /run/shm $CHROOT_DIR/$CHROOT_NAME/run/shm xhost +local: fi echo "Starting chroot." #dchroot -c $CHROOT_NAME sudo chroot $CHROOT_DIR/$CHROOT_NAME su - $1 export DISPLAY=$DIS_NUM echo "Chroot closed." if [ `cat /var/run/$CHROOT_NAME` -eq 1 ] then echo "Closing last invocation. Unmounting host system directories" for i in dev/pts proc dev sys run/shm hostfs do sudo umount $CHROOT_DIR/$CHROOT_NAME/$i sleep 0.5 done fi sudo bash -c "echo `expr \`cat /var/run/$CHROOT_NAME\` - 1` > /var/run/$CHROOT_NAME" if [ `cat /var/run/$CHROOT_NAME` -eq 0 ] then sudo rm /var/run/$CHROOT_NAME fi
Form now on we will be working inside the simulator (chroot).
- Install Yarp Installing YARP in debian
- Install necessary software:
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
Now we proceed to install necessary tools for the viewer to work
Install viewer Avispy:
#install avispy echo "install avispy" cd $HOME/local/src git clone https://github.com/arcoslab/avispy.git cd avispy make xstow_install
Install viewer roboview:
#install roboview echo "install roboview" cd $HOME/local/src git clone https://github.com/arcoslab/roboview.git cd roboview make xstow_install
install cmoc:
#install cmoc echo "install cmoc" cd $HOME/local/src git clone https://github.com/arcoslab/cmoc.git cd cmoc make xstow_install
install pyrovito:
#install pyrovito echo "install pyrovito" cd $HOME/local/src git clone https://github.com/arcoslab/pyrovito.git cd pyrovito make xstow_install
install vfl:
#install vfl echo "vfl" cd $HOME/local/src git clone https://github.com/arcoslab/vfl.git cd vfl make xstow_install
install arcospyu:
#install arcospyu echo "install arcospyu" cd $HOME/local/src git clone https://github.com/arcoslab/arcospyu.git cd arcospyu make xstow_install
Clone the follow repository that contain simulator and the viewer main programs. This repository most be cloned while been inside the chroot in the ~/local/src directory.
git clone https://github.com/Mauricio50060/motor-simulator
Running the programs
Ones you successfully clone the simulator and the viewer and your chroot is running correctly follow the next steps:
- Open one terminal and get inside the chroot proposed to this simulator and execute the command “yarpserver” (verify that there are not any error. Else correct them).
- In other terminal get inside the directory that contains the programs ¨simulator.py“ and viewer.py” and run the viewer program (you should see a black background windows)and then the simulator program in a third terminal by taping “python programs_name.py”.
- Ones you execute the simulator.py programs you will be asked to enter a quantity of current for the motor simulator to run. This number most be under 0.01 A for now since this is a protect in progress.
Frequent problems
- While configuring yarp code and selecting the features you need in “ccmake” and if you do not make an user in the chroot you should change the “CMAKE INSTALL PREFIX to /root/local/DIR/yarp”. This step also solves the QT5 problem when configuring ccmake ../.
- If you have any error while running the “simulator.py program this most be a communication problem just reload the terminal that is executing yarp.
Multi-optimization termal model
Documentation by Mauricio Rodríguez Calvo 2016/11/22
As part of master research project.