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 revisionPrevious revision
Next revision
Previous revision
getting_started:tutorials:oneaxis [2019/10/11 13:48] – [Experimental Setup] grafgetting_started:tutorials:oneaxis [2023/04/13 11:29] (current) – [Build Application] ursgraf
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]]. 
- +
-Navigate to the directory ''simple-motor-control'' where you can find the code. +
 =====Theoretical Background===== =====Theoretical Background=====
  
Line 16: Line 13:
  
 D is the damping factor and we choose it as 0.9. D is the damping factor and we choose it as 0.9.
- 
- 
  
 =====Experimental Setup===== =====Experimental Setup=====
-A maxon motor controller (50V / 5A) delivers the necessary power. The motor we use has the following properties:+The motor we use has the following properties:
  
 |  **Properties**              ^  Value            ^  Unit         ^ |  **Properties**              ^  Value            ^  Unit         ^
Line 28: Line 23:
  
 We use three different platforms for running the Simple Motor Controller. We use three different platforms for running the Simple Motor Controller.
-  * 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#comedi|]]. In any case you have to install ''comedi'' separately. +  * [[oneaxis_comedi|]] 
-{{ oneAxis_setup.png?688 |}} +  * [[oneaxis_bbb|]]   
-  * [[https://wiki.ntb.ch/infoportal/embedded_systems/ti_sitara_am335x/beaglebone_blue/start|Beaglebone Blue]] board together with the appropriate EEROS hardware wrapper, see [[eeros_architecture:hal:hardware_libraries#beaglebone_blue|]]. Please follow the instructions in [[https://wiki.ntb.ch/infoportal/software/linux/beagleboneblue]] to install the necessary toolchain before you install EEROS. +  * [[oneaxis_cb20|]]
-  * Our cb20 controller board ([[http://wiki.ntb.ch/infoportal/embedded_systems/imx6/cb#cb20_board|]] together with [[http://www.flink-project.ch|]] and the appropriate EEROS hardware wrapper, see [[eeros_architecture:hal:hardware_libraries#flink|]]. +
- +
-Connect all the necessary signals according to your hardware configuration file, notably +
-  * analog output and enable signal to the motor controller +
-  * encoder outputs (A/B signals) to the decoder inputs +
-  * motor controller ready signal to a digital input +
-  * emergency button to a digital input +
- +
-IMPORTANT Make sure that a positive voltage on the motor leads to the encoder counting upwards. If the opposite is the case, either change the cables or change the hardware configuration file. \\ +
-IMPORTANT On the beaglebone blue board, you don't need a motor controller. Hence, you do not need the enable signal. Tie the ready signal to logic one. +
  
 =====Build Application===== =====Build Application=====
  
-  - Install EEROS and necessary hardware libraries as described in [[getting_started:install_and_setup_development_environment|]] +  - Proceed with [[getting_started:write_app|]] and select the right targetScroll down to ''Use Existing Project''
-  - Build [[getting_started:compile_eeros|]], you already have the necessary libraries together with the applicationIf 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.+  - After cloning the project, navigate to the directory ''simple-motor-control'' where you can find the code of the application. 
 +  - [[getting_started:deploy|]] to the target system if necessary.
  
 =====Test Application===== =====Test Application=====
  
 You will find different hardware configuration files depending on the hardware platform. You will find different hardware configuration files depending on the hardware platform.
-  * HalComedi.json +  * HwConfigComedi.json 
-  * HalFlink.json +  * HwConfigFlink.json 
-  * HalBBB.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>
-$ sudo ./simpleMotorControl -c HalBBB.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.
 +
 +===== Develop your own Application Further =====
 +For further development we recommend to use an integrated development environment as described in [[getting_started:kdevelop|]]. You do not have to create a new project, because you already have downloaded and built the simple motor controller project. Import the project together with the EEROS and wrapper libraries into KDevelop.
 +
  
 =====Implementation===== =====Implementation=====
Line 66: Line 56:
 ==== Safety System ==== ==== Safety System ====
 Safety levels and events are declared in ''SMCSafetyProperties.hpp''. ''SMCSafetyProperties.cpp'' initializes these objects, defines critical inputs and outputs, defines level actions, and adds the levels to the safety system. The levels and events causing transitions between those levels are shown in the next figure. Safety levels and events are declared in ''SMCSafetyProperties.hpp''. ''SMCSafetyProperties.cpp'' initializes these objects, defines critical inputs and outputs, defines level actions, and adds the levels to the safety system. The levels and events causing transitions between those levels are shown in the next figure.
-[{{ :getting_started:tutorials:safetysystemoneaxis.png?600 |//Safety levels and events//}}]+[{{ :getting_started:tutorials:safetysystemoneaxis.jpg?700 |//Safety levels and events//}}]
  
 Two critical inputs are defined: "emergency" and "readySig1". "enable" is a critical output. Critical inputs and outputs are checked and set by each safety level. For example "enable" is set to ''true'' as soon as the safety level is equal or higher than ''powerOn''. "emergency" is unchecked for the two lowest levels and leads to level change to level ''emergency'' for higher levels.  Two critical inputs are defined: "emergency" and "readySig1". "enable" is a critical output. Critical inputs and outputs are checked and set by each safety level. For example "enable" is set to ''true'' as soon as the safety level is equal or higher than ''powerOn''. "emergency" is unchecked for the two lowest levels and leads to level change to level ''emergency'' for higher levels. 
getting_started/tutorials/oneaxis.1570794505.txt.gz · Last modified: 2019/10/11 13:48 by graf