====== Control System Using CAN ====== In the EEROS library you will find a directory with examples. This examples will only be present in your build directory if EEROS was built with ''-DUSE_CAN=TRUE'' set. ===== CAN Raw ===== For this example see [[https://github.com/eeros-project/eeros-framework/blob/master/examples/can/|CAN Examples]]. The first example (CANexample1) uses a simple control system with a block sending raw CAN frames to a MYACTUATOR RMD-X series drive and another one receiving from the drive. \\ Open a shell in the build directory of your EEROS library and run $ sudo ./examples/can/canExample1 ===== CANopen ===== A second example uses CANopen. Open a shell in the build directory of your EEROS library and run $ sudo ./examples/can/canExample2 ==== Control System ==== The system comprises a control system, a safety system and a sequencer with a few sequences. The example assumes that you have two drives in your CAN network. The node identifiers are '1' and '2'. The control system basically has a [[eeros_architecture:control_system:available_blocks:cansend|]] and a [[eeros_architecture:control_system:available_blocks:canreceive|]] block. While being in the safety level ''slInit'' the init sequence configures the drives to send TPDOs and receive RPDOs. Both drives are then brought into operational state and both blocks are enabled. ==== Safety System ==== The safety system incorporates a few levels with the necessary events to switch between them. The exit handler serves to shutdown the system in a controlled way. ==== Sequencer ==== The most important sequence is the ''initSequence''. It initialyzes the drives (by NMT commands and SDO transfers) and brings them up to operational mode (by PDO transfers). The ''moveSequence'' simply turns the motors back and forth while logging the velocity and the position. The ''stopSequence'' disables the drives before the program ends.