User Tools

Site Tools


eeros_architecture:control_system:available_blocks:canopenreceive

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
eeros_architecture:control_system:available_blocks:canopenreceive [2024/05/30 15:27] ursgrafeeros_architecture:control_system:available_blocks:canopenreceive [2024/05/30 17:37] (current) ursgraf
Line 2: Line 2:
 This block receives PDO packets over a CAN bus from a drive. The drives itself must be initialized by SDO transfers and brought into operational state where PDO transfer is possible. The control system must incorporate a block for sending and another one for receiving CAN messages, see [[eeros_architecture:control_system:available_blocks:canopensend|]]. This block receives PDO packets over a CAN bus from a drive. The drives itself must be initialized by SDO transfers and brought into operational state where PDO transfer is possible. The control system must incorporate a block for sending and another one for receiving CAN messages, see [[eeros_architecture:control_system:available_blocks:canopensend|]].
  
-Each time the block is run by its time domain, a TPDO1 (carrying the status word and actual velocity) and a TPDO2 (actual position and warnings) is received. The block has 4 output signals''status'', ''vel'', ''pos'', ''warnings''\\ +===== Data Transfer ===== 
-The velocity and position outputs are given in SI units, e.g. rad/s and rad. To account for encoder resolution of the actual drive together with a gearbox, it is possible to set a scaling factor with+Each time the block is run by its time domain, it reads as many TPDOs sent by its connected drives as has been configured beforehand. Each TPDO carries one or more CANopen objects. See [[https://gitlab.ost.ch/tech/inf/public/canopenlib/-/blob/master/demo/demo.md#demo-1]] for the configuration of the PDOs. Make sure, that you receive the TPDO exactly as your drive sends it. The //CANopen Receive// block has several outputs as shown below. 
 +{{:eeros_architecture:control_system:available_blocks:canopenreceive.png?600|}} 
 + 
 +Each drive has its own node id and its specific input index (0 to N-1). After the block has been created you have to configure the PDOs which are sent to each driveWhile doing this you must specify which of the signal inputs (floating point or fixed point) get included into which PDO. Both signals can be vectors. The method 
 <code cpp> <code cpp>
-setVelScale(Matrix<nofNodes,1,double>); +configureTPDO(uint8_t nodeIduint8_t TPDOnrstd::vector<coObject_tobjs, std::vector<int8_tidx)
-setPosScale(Matrix<nofNodes,1,double>);+
 </code>  </code> 
 +includes a vector of all CANopen objects which are mapped into this TPDO together with a corresponding vector of indices. These indices determine which signal is written to the output for this TPDO. To give an example: idx=1 writes the floating point signal at index 0, idx=2 writes the floating point signal at index 1, idx=0 writes to the status word and idx=-1 writes the integer signal at index 0.
 +How could this be used? Let us assume, that the drive with node id = 37 sends TPDO1 with status word and actual position and TPDO2 carries a digital input word (reading some buttons) and actual velocity. Let's further assume that the floating point input signal is a vector consisting of position and velocity values. The configuration would then be 
 +<code cpp>
 +configureTPDO(37, TPDO1, {statusObj, posActValObj}, {0,1});
 +configureTPDO(37, TPDO2, {digInStateObj,velActValObj}, {-1,2});
 +</code> 
 +
 +The status word has no output but can be read by the method
 +<code cpp>
 +getStatus(uint8_t index);
 +</code> 
 +
 +The floating point output signals should be in SI units, e.g. rad/s. To account for encoder resolution of the actual drive together with a gearbox, it is possible to set a scaling factor with
 +<code cpp>
 +setScale(Matrix<N,M,double>);
 +</code> 
 +
 This blocks uses the [[https://gitlab.ost.ch/tech/inf/public/canopenlib|CANopen Library]]. Make sure to install this library following [[https://wiki.eeros.org/getting_started/install_wrapper#canopen|]]. This blocks uses the [[https://gitlab.ost.ch/tech/inf/public/canopenlib|CANopen Library]]. Make sure to install this library following [[https://wiki.eeros.org/getting_started/install_wrapper#canopen|]].
eeros_architecture/control_system/available_blocks/canopenreceive.1717075639.txt.gz · Last modified: 2024/05/30 15:27 by ursgraf