Oroplatform
The c++ libraries developed to control the platform has been integrated in an Orocos component. In addition, it has been developed two components to send the desired target to oroplatform component. The first one is Orogen an orocos component that provides a trajectory to be followed by the platform. The second one is Joystick a ROS node that commands the platform using a joystick.
Download and install
#The following lines show how to install the oroplatform component. Repeate this procedure for orogen component
cd oroplatform
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/srv/robotica/orocos -DOROCOS_TARGET:string=xenomai
make
sudo make install
For a quickly installation of all component from these repository use the file install_package.sh. Select the variables at your convenience. To install this component is necessary to have installed the cpp4ec and platform library commented in previous sections.
Running oroplatform with generator
deployer-xenomai -s ../config_platform_generator.ops
To exit correctly from deployer type "quit" or press "ctrl+D"
Configuration file
The config_platform_generator.ops file showed below. It configures and starts the generator and platform components.
#With this .ops we configure and start two components that exchange information using a port
path("/srv/robotica/orocos/lib/orocos/xenomai");#the path where the components are installed
require("print"); # necessary for 'print.ln'
import("oroplatform"); # 'oroplatform' is a directory name to import
import("orogen");
displayComponentTypes(); # Function of the DeploymentComponent
loadComponent("platform","Oroplatform");# Creates a new component of type 'Oroplatform'
loadComponent("generator", "Orogen");
set platform.ecPort = "rteth0"; #Set the attibutes of the component platform
set platform.platformType = 2;
set platform.controlMode = 9;
set platform.platformReference = false;
setActivity("platform", 0.001, 90, ORO_SCHED_RT);#creates an activity for the platform with: period = 1ms ,priority = 90(HighestPrioty=99), scheduler = ORO_SCHED_RT
setActivity("generator", 0.001, 89, ORO_SCHED_RT);
connectPeers("generator", "platform");#For exchange information components have to be peers
var ConnPolicy cp_1; #Specifying the connection type
cp_1.type = DATA
cp_1.size = 1
cp_1.lock_policy = LOCKED
connect("generator.outPort", "platform.DesiredPlatformPose",cp_1);
platform.configure();
#Quickly start because DC are used, and if not an error occurs
platform.start();
generator.configure();
generator.start();
In this file is important to set properly the installation path of the components and the different attributes.
- ecPort specify the ethercat port.
- platformType
- 1 = bmm1 platform
- 2 = bmm2 platform
- controlType
- 3 = profile velocity
- 9 = cyclic velocity (used with the generator)
- 4 = profile torque
- 10 = cyclic torque
- 11 = adaptive controller
- platformReference
- true = the platform reference system is used as the reference system for the targets
- false = the absolute Cartesian reference system is used as the reference system for the targets
Running oroplatform with joystick
To communicate and orocos component (oroplatform) with a ros node (Joystick) is used rtt_ros_integration package. The oroplatform component has to be compiled with catkin. For example follow these step in the bmm2 for installing and running oroplatform component:
catkin_init_workspace
ln -s ~/bmm-component/oroplatform/
cd ..
export OROCOS_TARGET=xenomai #If it is wanted to compile with xenomai. Gnulinux by default.
catkin_make_isolated --install
source devel_isolated/setup.bash
Before running this component is necessary to load some important environment variables specified in the load_orocos-ros_env.sh file.
export ROS_PACKAGE_PATH=$HOME/catkin_ws/src #Where the packeges are located
export RTT_COMPONENT_PATH=$HOME/catkin_ws/install_isolated/lib/orocos #Where the orocos component is installed
export ROS_MASTER_URI=http://bmm2:11311 #Where is running the roscore
If the ros components have not been installed (that is, have only been compiled with 'catkin_make') the load_orocos-ros_env.sh file should include:
export ROS_PACKAGE_PATH=$HOME/catkin_ws/src #Where the packeges are located
export RTT_COMPONENT_PATH=$HOME/catkin_ws/devel/lib/orocos #Where the orocos component is compiled
export ROS_MASTER_URI=http://bmm2:11311 #Where is running the roscore
Running deployer with config_platform_joystick.ops file it will run oroplatform component and it will connect to the joystick topic. In this file only change the way to import this component and the command to connect the port with a topic.
ros.import("oroplatform") #import the component with rtt_ros
stream("platform.DesiredPlatformPose", ros.topic("joystick")) #connect the specified port with the joystick topic
Execute deployer. It's important that the roscore is running.
If xenomai is used, execute as:
Once done this, The joystick node has to be executed from the remote PC. So run the joystick node using the joystick.launch. Remember to source the environment variables the first time it's executed
roslaunch joystick joyctick.launch