User Tools

Site Tools


getting_started:tutorials:oneaxis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
getting_started:tutorials:oneaxis [2019/04/25 14:19]
graf [Part 3: Test Application]
getting_started:tutorials:oneaxis [2019/10/15 12:27] (current)
graf [Experimental Setup]
Line 1: Line 1:
 ====== Control a Single Motor ====== ====== Control a Single Motor ======
  
-This tutorial will show you how to control a single motor using EEROS. This example is located in a separate repository [[https://​github.com/​eeros-project/​simple-motor-control.git]]. ​It will be downloaded and built automatically if you follow [[getting_started:​install_and_setup_development_environment#​Getting the Sources with a Script|]]. ​+This tutorial will show you how to control a single motor using EEROS. This example is located in a separate repository [[https://​github.com/​eeros-project/​simple-motor-control.git]]. ​ 
 +=====Theoretical Background=====
  
-Navigate to the directory ''​simple-motor-control''​ where you can find the code. +motor position is measured by an encoder. After differentiating this signal we obtain the velocity. The input of the velocity controller is the difference between reference and measured velocity. Additionally,​ the feed forward velocity is added. The output of this controller is an acceleration. This value is then multiplied by the inertia and divided by the motor constant, in order to obtain a current reference value to control the motor.
- +
-=====Part 1: Theoretical Background===== +
- +
-The motors ​position is measured by an encoder. After differentiating this signal we obtain the velocity.+
  
 [{{ oneAxis_controlLoop.jpg?​688 | //Control loop//}}] [{{ oneAxis_controlLoop.jpg?​688 | //Control loop//}}]
Line 17: Line 14:
 D is the damping factor and we choose it as 0.9. D is the damping factor and we choose it as 0.9.
  
-The input of the velocity controller is the difference between reference and measured velocity. Additionally,​ the feed forward velocity is added. The output of this controller is an acceleration. This value is then multiplied by the inertia and divided by the motor constant, in order to obtain a current reference value to control the motor. +=====Experimental Setup===== 
- +The motor we use has the following properties:
-=====Part 2: Experimental Setup===== +
-As a processing platform we use a regular PC (x86-64) together with a National Instrument card: PCIe - 6251 (M-Series). The card requires the //comedi// library together with the EEROS hardware wrapper, see [[eeros_architecture:​hal:​hardware_libraries|]]. In any case you have to install ''​comedi''​ separately. +
-{{ oneAxis_setup.png?​688 |}} +
-As an alternative we use our cb20 controller board ([[http://​wiki.ntb.ch/​infoportal/​embedded_systems/​imx6/​cb|]] together with [[http://​www.flink-project.ch|]] and the appropriate EEROS hardware wrapper, see [[eeros_architecture:​hal:​hardware_libraries|]]. \\ +
-For both alternatives a maxon motor controller (50V / 5A) delivers the necessary power. ​The motor we use has the following properties:+
  
 |  **Properties** ​             ^  Value            ^  Unit         ^ |  **Properties** ​             ^  Value            ^  Unit         ^
Line 30: Line 22:
 ^  Encoder Pulses ​   |  500          |        | ^  Encoder Pulses ​   |  500          |        |
  
-=====Part 3: Test Application===== +We use three different platforms for running the Simple Motor Controller. 
-If have have installed and built EEROS as described in [[getting_started:​install_and_setup_development_environment|]] and [[getting_started:​compile_eeros|]], you already have the necessary libraries together with the application. If you use ''​comedi''​ navigate to the build directory of your simple motor control directory. If you use the cb20 board, follow the instruction in [[https://​github.com/​ntb-ch/​cb20]] to download the necessary files to the target.+  ​* ​[[oneaxis_comedi|]] 
 +  * [[oneaxis_bbb|]]   
 +  * [[oneaxis_cb20|]]
  
-You will find two different hardware configuration files. +=====Build Application===== 
-  * HalComedi.json + 
-  * HalFlink.json+  - Download EEROS, hardware wrapper libraries, and simple motor application described in [[getting_started:​install_and_setup_development_environment|]]. Make sure that the following entry in ''​config.sh.in''​ is as follows <​code>​ 
 +use_custom_application=true 
 +</​code>​ 
 +  - After cloning with the clone script, navigate to the directory ''​simple-motor-control''​ where you can find the code of the application. 
 +  - [[getting_started:​compile_eeros|]] together with the application. 
 +  - [[getting_started:​deploy|]] to the target system if necessary. 
 + 
 +=====Test Application===== 
 + 
 +You will find different hardware configuration files depending on the hardware platform
 +  * HwConfigComedi.json 
 +  * HwConfigFlink.json 
 +  * HwConfigBBB.json
  
 Start our application by choosing the appropriate configuration file, e.g.: Start our application by choosing the appropriate configuration file, e.g.:
 <​code>​ <​code>​
-$ ./​simpleMotorControl -c HalComedi.json+sudo ./​simpleMotorControl -c HwConfigBBB.json
 </​code>​ </​code>​
 +The application logs the motor position once per second. By activating the emergency button, the safety system will immediately switch to an emergency state. Deactivating this button causes the system to switch back to running mode.
  
-=====Part 4: Implementation=====+===== Develop your own Application Further ===== 
 +For further development we recommend to use an integrated development environment as described in [[getting_started:say_hello|]]. You do not have to create a new project, because you already have downloaded and built the simple motor controller project. Hence, you import the project together with the EEROS and wrapper libraries into KDevelop as described in [[getting_started:​say_hello#​Use_KDevelop_with_Existing_Build_Configuration|Use KDevelop with Existing Build Configuration]]. 
 + 
 + 
 +=====Implementation=====
 ==== Control System ==== ==== Control System ====
 The control system declares in ''​ControlSystem.hpp''​ all the necessary blocks as given in the picture at the top of this page. Those blocks are then defined in ''​ControlSystem.cpp'',​ connected together, and added to a time domain. At last the time domain is added to the executor. \\ The control system declares in ''​ControlSystem.hpp''​ all the necessary blocks as given in the picture at the top of this page. Those blocks are then defined in ''​ControlSystem.cpp'',​ connected together, and added to a time domain. At last the time domain is added to the executor. \\
Line 53: Line 64:
  
 ==== Sequencer ==== ==== Sequencer ====
-The sequencer runs a sequence which turns the motor several steps forwardAfter 20 seconds it will position the motor back to some base position and restart the process. +The sequencer runs a sequence which turns the motor each second a tenth of a full turn
getting_started/tutorials/oneaxis.1556194778.txt.gz · Last modified: 2019/04/25 14:19 by graf