The purpose of this guide is to show how to configure the controller to receive RPDO messages from a CAN master, in order to receive its Motor Command or Speed command. For this example, we are going to use a CAN sniffer and the PCAN-View software to send the RPDO from the PC. 

The controller will be configured for Closed Loop Speed operation mode for this example. More info on this, can be found in this separate guide : Closed Loop Speed - G4

Note: In Open Loop mode, only the Motor Command is accepted (Syntax serial : !G [channel] [-1000...+1000]). In Closed Loop Speed mode, one can use either the Motor Command (which will be translated to % of the Max RPM setting) or the Speed Command (Syntax serial : !S [channel] [target RPM] )

    CAN networking manual v2.1a

Configurations in Roborun+ 

  • CAN Mode : CANOpen
  • Bit rate : 250 (depends on the master's configuration) 
  • Node ID : 1 (depends on the master's configuration)
  • Heartbeat : 100ms (optional)

  • RPDO1 mapping : Motor Command ch1 (object 0x2000 | sub-index 01 | 4 bytes)

This PDO mapping feature is available with firmware versions v2.1a or later. 

  • CANOpen Autostart : Enabled 

Test with CAN monitoring software

At this point we can prepare the RPDO1 frame on our PC and send it using a CAN monitoring software like PCAN-view.

Let's suppose we want to send Motor Command 700(=70% PWM). 

RPDO1 COB-id = 200 + nodeID = 201 

In hexadecimal, Motor command 700 = 0x2BC

We want to extend this to 4 bytes, and also want to have little-Endian byte order (LSB first).

Therefore : 00 00 02 BC  -->  BC 02 00 00 

Make sure you add a cycle time so the command does not expire (Command watchdog set to non-zero value in Roborun)

Let's now see how our motor will respond to this command, using Roborun+. We will send the command and after a small delay stop it from PCAN, and let it time out.

We see that Feedback(speed in RPM) follows the Ramped command very well. The ramped command in Closed Loop Speed mode, reported the commanded speed. We had configured Maximum speed (RPM) at 1500. 

So 70% * 1500 = 1050 RPM , the commanded speed. 

We had a slight overshoot up to 1059 which can be seen in the Max logged value of the chart. 

Send a Speed Command directly 

Let's say we want Speed = 1200 = 0x4B0 in hex. 

We re-map the RPDO1 to the object 0x2002 which is Set Velocity. 

Change our CAN frame to send the value 0x4B0 , and this time we will add a 0RPM command also to stop the motor. Remember, LSB first !

To send negative speed command, we simply transmit the 2's complement of the original HEX (or binary) value.