Difference between revisions of "CAN Protocol"

From Wiki
(Added hint to Rebel Joints article)
m (Text updated)
 
Line 4: Line 4:
 
Commonplace Robotics uses the CAN field bus to send position set point values from the robot controller to the  joint modules. The applied protocols are custom, but quite simple.  
 
Commonplace Robotics uses the CAN field bus to send position set point values from the robot controller to the  joint modules. The applied protocols are custom, but quite simple.  
  
===Two version are used===
+
=Protocol versions=
* CPRCAN: 16 bit position data used for  Mover4 and  Mover6 robots and Slider platforms
+
* CPRCAN: 16 bit position data. Used for  Mover4 and  Mover6 robots and Slider platforms
* CPRCANV2: 32 bit position data used for SRA and Mover6-2016 (understands both, CPRCAN and CPRCANV2) robots.  
+
* CPRCANv2: 32 bit position data. Used for SRA, Mover6-2016 (understands both, CPRCAN and CPRCANV2) and all stepper based robots.
 +
* CPRCANv3: 16 bit motor current values and new firmware parameter messages. Used for BLDC controls including [[Igus ReBeL|igus ReBeL arms]]. Follow the CPRCANv2 examples since the protocol is mostly the same.
  
The position set point messages have to be send in a loop with e.g. 20 Hz. The application has to verify that this loop has a constant cycle time.
+
The position set point messages have to be send in a loop at a constant frequency of e.g. 10 or 20 Hz. If the jitter is too big the motion might not be smooth or the communication (timeout) error may occur. Additionally the application has to send state change messages like reset errors and enable motors.  
If the jitter is too big the motion control modules might get into a communication loss error state. Additionally the application has to send state change messages like reset-all-errors and enable-motors.  
 
  
The joint modules answer with an error code that provides the current state.
+
The modules answer the position or IO state message with position/input states and an error code that provides the current state.
  
==CPR CAN Documentation and Demo Code==
+
=CPR CAN Documentation and Demo Code=
* '''Documentation: [http://www.cpr-robots.com/download/CAN/UserGuide_ProtocolCPRCAN.pdf CAN protocol documentation]'''
+
* Documentation
* [[Rebel_Joint|Rebel Joints and BLDC axes]] use a slightly modified protocol, you can find the documentation in the Rebel Joints article.
+
** [[Rebel_Joint|CANv2/CANv3 protocol specification]]
* Linux examples: C sources can be downloaded at [http://www.github.com/CPR-Robots www.github.com/CPR-Robots]
+
** [http://www.cpr-robots.com/download/CAN/UserGuide_ProtocolCPRCAN.pdf CANv1/CANv2 documentation]
* '''C# demo: [http://www.cpr-robots.com/download/CAN/CPRMoverDemoCSharp.zip Source code] for Visual Studio Express 2012'''
 
** The example code builds on the [https://www.peak-system.com/fileadmin/media/files/pcan-basic.zip PCAN basic API], [[media:PCAN_basic_API.zip|mirror]] to communicate via the [https://www.peak-system.com/PCAN-USB.199.0.html PCAN-USB adapter]. The documentation for the API can be found in chapter 5 of the [http://www.peak-system.com/produktcd/Pdf/English/PCAN-USB_UserMan_eng.pdf PCAN-USB Manual], [[media:PCAN_Windows_Driver_Manual.pdf|mirror]]
 
Currently we are updating the example source code to the cprcanv2 protocol. Please get in contact if you need these sources.
 
  
==CAN Hardware / Drivers==
+
* Example source code
Most robots and control electronics are usually supplied with a white [https://www.peak-system.com/PCAN-USB.199.0.html PCAN USB adapter]. The robolink DCi robots are not supplied with a CAN adapter as the communication between PC and robot is via Ethernet and a CAN adapter is not required for operation and programming of the robot.
+
** [https://github.com/CommonplaceRobotics/CANV2ProtocolDemoClient CANv2 example source code in C# for Windows]
 
+
*** If you do not need motor current values you can use this example for CANv3 without any changes
''If you have a black PCAN adapter, [[Support Routes|get in touch with us]]. The following driver links will likely not work for you.''
+
** [https://github.com/CPR-Robots/Mover4 CANv1 example source code in C++ for Linux] (deprecated)
 
+
** [http://www.cpr-robots.com/download/CAN/CPRMoverDemoCSharp.zip CANv1 example source code in C# for Windows] for Visual Studio Express 2012 (deprecated)  
===for Windows 10, 8.1, 7 (32/64-bit)===
 
The PCAN USB Windows driver for the adapter can be found on the CPRog installation CD, if supplied, or downloaded here:
 
*[https://www.peak-system.com/quick/DrvSetup PCAN Windows driver], [[media:PCAN_Windows_Driver.zip | mirror]]
 
*[http://www.peak-system.com/produktcd/Pdf/English/PCAN-USB_UserMan_eng.pdf PCAN USB Manual], [[media:PCAN_Windows_Driver_Manual.pdf|mirror]]
 
*CAN Bus Monitor for debugging [https://www.peak-system.com/fileadmin/media/files/pcanview.zip PCAN View], [[media:PCAN_View.zip|mirror]]
 
 
 
===for Linux===
 
For the ROS environment a Linux driver is required. It can be found here:
 
* If you use ROS with example code from our [https://github.com/CPR-Robots/ git repos], you will notice that the documentation of the ROS repos will refer to this version of the driver [https://www.peak-system.com/fileadmin/media/linux/files/peak-linux-driver-7.10.tar.gz PEAK-Linux-driver-7.10], [[media:PCAN_linux_driver_7.10.tar.gz|mirror]]. This is what we tested our code with.
 
**For installation instructions have a look at section 4 in [https://github.com/CPR-Robots/cpr_mover/blob/master/doc/CPRMoverROSDoc.pdf this document]
 
**[https://www.peak-system.com/fileadmin/media/linux/files/PCAN%20Driver%20for%20Linux_eng_7.1.pdf Manual], [[media:PCAN_linux_driver_manual_7.10.pdf |mirror]]
 
 
 
* Latest driver for Linux (still untested with our example code)  
 
**Since mainline kernel 3.4, the driver is part of the kernel. However, we have not fully tested our code with this driver yet. It is on the "to do" list.
 
**PCAN offers a separate driver as well: https://www.peak-system.com/fileadmin/media/linux/files/peak-linux-driver-8.5.1.tar.gz PEAK Linux driver 8.5.1], [[media:peak-linux-driver-8.5.1.tar.gz|mirror]]
 
**[https://www.peak-system.com/fileadmin/media/linux/files/PCAN-Driver-Linux_UserMan_eng.pdf Manual], [[media:PCAN_linux_driver_manual_8.5.1.pdf|mirror]].
 
**For installation instructions, please refer to the manual linked above.
 
  
 +
=CAN Hardware / Drivers=
 +
Most robot controls from Commonplace Robotics come with an embedded control computer, in which case you do not need to access the CAN protocol, use the [[Control Interfaces|high level control interfaces]] instead. For robot controls without embedded control computer, e.g. the [[igus ReBeL|igus ReBeL Open Source version]] or separate ReBeL joints we recommend using the [https://www.peak-system.com/PCAN-USB.199.0.html PCAN USB adapter]. This adapter is supported by our support tools (e.g. [[Module Control]] for configuring joints) and example source code. We recommend not to use other adapters since we will not be able to support you.
  
 
[[Category:Downloads]]
 
[[Category:Downloads]]

Latest revision as of 13:11, 27 March 2025

Searching for igus Rebel robot or joints docs? Then please go to this page: Rebel Joint for specific documentation!

Commonplace Robotics uses the CAN field bus to send position set point values from the robot controller to the joint modules. The applied protocols are custom, but quite simple.

Protocol versions

  • CPRCAN: 16 bit position data. Used for Mover4 and Mover6 robots and Slider platforms
  • CPRCANv2: 32 bit position data. Used for SRA, Mover6-2016 (understands both, CPRCAN and CPRCANV2) and all stepper based robots.
  • CPRCANv3: 16 bit motor current values and new firmware parameter messages. Used for BLDC controls including igus ReBeL arms. Follow the CPRCANv2 examples since the protocol is mostly the same.

The position set point messages have to be send in a loop at a constant frequency of e.g. 10 or 20 Hz. If the jitter is too big the motion might not be smooth or the communication (timeout) error may occur. Additionally the application has to send state change messages like reset errors and enable motors.

The modules answer the position or IO state message with position/input states and an error code that provides the current state.

CPR CAN Documentation and Demo Code

CAN Hardware / Drivers

Most robot controls from Commonplace Robotics come with an embedded control computer, in which case you do not need to access the CAN protocol, use the high level control interfaces instead. For robot controls without embedded control computer, e.g. the igus ReBeL Open Source version or separate ReBeL joints we recommend using the PCAN USB adapter. This adapter is supported by our support tools (e.g. Module Control for configuring joints) and example source code. We recommend not to use other adapters since we will not be able to support you.