RoPod/Tutorials/Matlab and ROPOD platform interface: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
(Created page with '<div style="width: 40%; float: right;"><center>{{:RoPod_Table_Menu}}</center></div> <div STYLE="float: left; width:60%"> =Install gcc 4.9= To be able to compile the library to…')
 
No edit summary
Line 41: Line 41:




<ul>
*mot_drivemode
  <li>mot_drivemode</li>
:0x00 = Velocity control, 0x01 = current only control
    <ol>
      <li>0x00 = Velocity control, 0x01 = current only control</li>
    </ol>


      <li>mot_command:
*mot_command:
      Action request sent to the motor: </li>
:Action request sent to the motor


<table style="width:80%">


*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:
<table>
   <tr>
   <tr>
     <th>bit</th>  
     <th>bit</th>  
Line 58: Line 67:
   <tr>
   <tr>
     <td>0</td>
     <td>0</td>
     <td>Motor enable request</td>   
     <td>Motor enabled</td>   
   </tr>
   </tr>
   <tr>
   <tr>
Line 66: Line 75:
   <tr>
   <tr>
     <td>2</td>
     <td>2</td>
     <td>internal only (request motor actual values in response)</td>   
     <td>Voltage below 18V, disables motor</td>   
   </tr>
   </tr>
   <tr>
   <tr>
     <td>3</td>
     <td>3</td>
     <td>internal only (request accell and gyro values in response)</td>   
     <td>Voltage above 32V, disables motor</td>   
   </tr>
   </tr>
   <tr>
   <tr>
     <td>4</td>
     <td>4</td>
     <td>unused</td>  
     <td>Mosfet temperature over 85C, disables motor</td>  
   </tr>
   </tr>
   <tr>
   <tr>
     <td>5</td>
     <td>5</td>
     <td>Parameter save to EEPROM request (positive edge triggered)</td>   
     <td>Save to eeprom finished</td>   
   </tr>
   </tr>
   <tr>
   <tr>
     <td>6</td>
     <td>6</td>
     <td>BISS sensor calibration mode request (positive edge triggered)</td>   
     <td>Motor phasing in progress</td>   
   </tr>
   </tr>
   <tr>
   <tr>
     <td>7</td>
     <td>7</td>
     <td>Motor phasing calibration request (positive edge triggered)  </td>  
     <td>BISS absolute sensor in calibration mode</td>  
   </tr>
   </tr>
</table>
</table>


 
*mot_Current:  
</ul>
:Motor current in Amperes
 
*mot_Velocity:  
=TBD=
:Angular velocity in rad/sec
mot_command:
*mot_Position:
Action request sent to the motor:
:Wheel position in rad
Bit  Description
*mot_InputVoltage:  
0    Motor enable request
:Motor voltage in Volts
1    unused
*mot_PivotPosition:  
2    internal only (request motor actual values in response)
:Angular position of each pair of wheels in rad.
3    internal only (request accell and gyro values in response)
4    unused
5    Parameter save to EEPROM request (positive edge triggered)
6    BISS sensor calibration mode request (positive edge triggered)
7    Motor phasing calibration request (positive edge triggered) 
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:
Additionally, the platform has a gyro sensor on each pair of wheels. The gyro sensor data is:
gyr_Update:
*gyr_Update:
Cyclic counter, increments after each packet exchange.
:Cyclic counter, increments after each packet exchange.
gyr_Temperature:
*gyr_Temperature:
Temperature of gyro sensor in Celsius degrees.
:Temperature of gyro sensor in Celsius degrees.
gyr_xacc:  
*gyr_xacc:  
Acceleration in local x axis in m/sec^2
:Acceleration in local x axis in m/sec^2
gyr_yacc:  
*gyr_yacc:  
Acceleration in local y axis in m/sec^2
:Acceleration in local y axis in m/sec^2
gyr_zacc:
*gyr_zacc:
Acceleration in local z axis in m/sec^2
:Acceleration in local z axis in m/sec^2
gyr_xvele:  
*gyr_xvele:  
Gyro Velocity in local x axis in rad/sec
:Gyro Velocity in local x axis in rad/sec
gyr_yvel:  
*gyr_yvel:  
Gyro Velocity in local y axis in rad/sec
:Gyro Velocity in local y axis in rad/sec
gyr_zvel:  
*gyr_zvel:  
Gyro Velocity in local z axis in rad/sec
:Gyro Velocity in local z axis in rad/sec


Run the interface test  
=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).
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.  
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.  

Revision as of 17:10, 23 March 2017


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

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


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.