RoPod/Tutorials/Matlab and ROPOD platform interface

From Control Systems Technology Group
Jump to navigation Jump to search


Install gcc 4.9

To be able to compile the library to communicate with the ropod, the gcc compiler version 4.9 is needed. Run in a terminal the following commands:

sudo apt-get update
sudo apt-get install gcc-4.9

Build and install the communication library

As the following files are not on the repository yet, you can not continue the tutorials at this moment.  

Only to install the library, run matlab as administrator:

sudo matlab &

Go to the main folder containing the test example files. Then build and install SOEM (Simple Open EtherCAT Master) library, in matlab:

cd some 
Build_and_Install_SOEM
cd ..

now close matlab and re-run it as user:

matlab &

Make and build the interface test

First make the ropod simulink libraries to run your test. Run in matlab:

Make_ropod_libraries

Then, you can open the test file “Ecat_Test_Example.slx”. To build the model, press “Ctrl+B”.

The executable file “Ecat_Test_Example” should appear in the current folder

Explore the ropod interface

Examine the file “Ecat_Test_Example.slx” and get familiar with the interface.

Each motor receives commands at a rate of 200Hz with the following formatting:

  • mot_drivemode
0x00 = Velocity control, 0x01 = current only control
  • mot_command:
Action request sent to the motor
  • mot_velocitySP:
Velocity setpoint (rad/sec) when velocity control is active. In velocity control mode, the internal controller has a sampling time of 1kHz.
  • mot_currentSP:
Current setpoint (Amperes) when current control is active. In current control mode, the internal controller has a sampling time of 10kHz.

When velocity mode is active, this current setpoint is used as maximum allowable current.

Moreover, the following data is read from each motor:

  • mot_Update:
Cyclic counter, increments after each packet exchange with motor controllers
  • mot_Status:
bit Description
0 Motor enabled
1 unused
2 Voltage below 18V, disables motor
3 Voltage above 32V, disables motor
4 Mosfet temperature over 85C, disables motor
5 Save to eeprom finished
6 Motor phasing in progress
7 BISS absolute sensor in calibration mode
  • mot_Current:
Motor current in Amperes
  • mot_Velocity:
Angular velocity in rad/sec
  • mot_Position:
Wheel position in rad
  • mot_InputVoltage:
Motor voltage in Volts
  • mot_PivotPosition:
Angular position of each pair of wheels in rad.


Additionally, the platform has a gyro sensor on each pair of wheels. The gyro sensor data is:

  • gyr_Update:
Cyclic counter, increments after each packet exchange.
  • gyr_Temperature:
Temperature of gyro sensor in Celsius degrees.
  • gyr_xacc:
Acceleration in local x axis in m/sec^2
  • gyr_yacc:
Acceleration in local y axis in m/sec^2
  • gyr_zacc:
Acceleration in local z axis in m/sec^2
  • gyr_xvele:
Gyro Velocity in local x axis in rad/sec
  • gyr_yvel:
Gyro Velocity in local y axis in rad/sec
  • gyr_zvel:
Gyro Velocity in local z axis in rad/sec

Run the interface test

For this test it is recommended to place the platform on top of some block such that the wheels can move freely. Be sure you place ONLY ONE battery (this issue will be solved).

Then connect the ethernet from your computer to the port “IN” of the ropod platform. Now you can turn on the power of the ropod.

Open a terminal and add usr/local/lib to the environment LD_LIBRARY_PATH. To do it permanently, add it to the baschrc file. You can run the following command:

echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib'  >> ~/.bashrc

Then, to run the file you must log in as root user:

sudo su

Due to some technical issue of the wheels, rotate each wheel until the color markers on them are on the highest position. Then, simply run the executable file:

./Ecat_Test_Example

All wheels should start moving then.

To be able to make changes online to the constants on the model, you need to connect Simulink with the running executable file. Press the connect to target button:alt text

You can now change the velocity commands to verify correct functionality.

Now you can create your own program to make the ropod platform move as desired. You can use blocks with s-functions (embedded c code) to implement your functionality.

Lets continue with the ROS installation.