  * [ Home  ](Home.59.0.html?&L=1)
  * [ Company  ](Company.58.0.html?&L=1)
  * [ Products  ](Products.57.0.html?&L=1)
  * [ Services  ](Services.56.0.html?&L=1)
  * [ Support  ](Support.55.0.html?&L=1)
  * [ Forum  ](Forum.133.0.html?&L=1)
  * [ Contact  ](Contact.54.0.html?&L=1)


#  Package Summary


[ ![](typo3temp/pics/e6125a39e1.jpg) ](PCAN-MicroMod-FD-
Configuration.513.0.html?&L=1)


Right now driver only supports velocity control mode as this was my prime area
of interest for my own project but it can be extended to provide support for
other modes of control. I would be happy to accept any pull requests extending
funtionality of this driver.


**Package Links**


####  [ CANopen PC Developer Kit ](CANopen-PC-Developer-Kit.259.0.html?&L=1)


	return 0;
}
And got the same:
Screenshot from 2021-12-16 11-32-43.png
Screenshot from 2021-12-16 11-32-43.png (23.4 KiB) Viewed 2685 times
I also thought it was a possible problem with the message as the segmentation fault usually pops up when trying to access an array wrongly (i believe).


[ PEAK-System Driver and Software Analysis Tool ](PEAK-System-
Information.557.0.html?&L=1)


    * [ All features ](/features)
    * [ Documentation  ](https://docs.github.com)
    * [ GitHub Skills  ](https://skills.github.com/)
    * [ Blog  ](https://github.blog)


Go to file


Query


|

View all files

##  Repository files navigation


Works


Parameter name  |  Type  |  Description
---|---|---
` can_device ` |  String  |  CAN device name as it appears on ifconfig
interface list, default is can0
` can_rx_topic ` |  String  |  Topic name through which driver receives CAN
messages from socketcan_bridge
` can_tx_ropic ` |  String  |  Topic name through which driver sends CAN
messages to socketcan_bridge
` update_rate ` |  Double  |  Update rate in Hz of how frequently driver gets
data from ODrive controllers
` engage_on_startup ` |  Boolean  |  If driver should engage all motors on
startup (not implemented yet)
` axis_min_velocity ` |  Double  |  Minimum axis velocity, if target velocity
is less then this value then it is set to this value (if set to 1.0 target
velocity of 0.5 will become 1.0, target velocity of -0.5 will become -1.0)
` axis_names ` |  String[]  |  Array of names of axises which are then used to
name topics corresponding to axises
` axis_can_ids ` |  Int[]  |  Array of axis CAN ids as they are configured on
ODrive controllers for every axis
` axis_directions ` |  String[]  |  Axis direction either ` forward ` or `
backward ` , ` backward ` reverses axis control, angle and current velocity

An example configuration is presented in config/odrive.yaml.


###  Running the driver


* **lunar:** _Documentation generated on May 04, 2019 at 10:38 AM_ ( [ doc job ](http://build.ros.org/view/Ldoc/job/Ldoc__ros_canopen__ubuntu_xenial_amd64) ).


(not available for all drivers)


** Used by  (8) **


####  [ Thermocouple Configuration ](Thermocouple-
Configuration.550.0.html?&L=1)


Documented


[ ![](typo3temp/pics/32df12492a.jpg) ](PEAK-Trace-Splitter.555.0.html?&L=1)


##  Folders and files


** Jenkins jobs  (6) **


	// forever loop
	while (1) {


#  Provide feedback


      * [ PLIN-API ](PLIN-API.444.0.html?&L=1)
    * [ PC Software ](PC-Software.234.0.html?&L=1)
      * [ PCAN-View ](PCAN-View.242.0.html?&L=1)
      * [ PLIN-View Pro ](PLIN-View-Pro.243.0.html?&L=1)
      * [ PCAN-OBD-2 Viewer ](PCAN-OBD-2-Viewer.535.0.html?&L=1)
      * [ Virtual PCAN-Gateway ](Virtual-PCAN-Gateway.390.0.html?&L=1)
      * [ Bit Rate Calculation Tool ](Bit-Rate-Calculation-Tool.496.0.html?&L=1)
      * [ CAN FD Frame Analyzer ](CAN-FD-Frame-Analyzer.563.0.html?&L=1)
      * [ PCAN-MicroMod Configuration ](PCAN-MicroMod-Configuration.244.0.html?&L=1)
      * [ PCAN-MicroMod FD Configuration ](PCAN-MicroMod-FD-Configuration.513.0.html?&L=1)
      * [ Thermocouple Configuration ](Thermocouple-Configuration.550.0.html?&L=1)
      * [ Thermocouple FD Configuration ](Thermocouple-FD-Configuration.551.0.html?&L=1)
      * [ PPCAN-Editor 2 ](PPCAN-Editor-2.245.0.html?&L=1)
      * [ PCAN-Linux ](PCAN-Linux.358.0.html?&L=1)
      * [ PCAN-FMS Simulator 2 ](PCAN-FMS-Simulator-2.246.0.html?&L=1)
      * [ PCAN-Trace ](PCAN-Trace.247.0.html?&L=1)
      * [ PEAK-Trace Splitter ](PEAK-Trace-Splitter.555.0.html?&L=1)
      * [ PCAN-Symbol Editor 3 ](PCAN-Symbol-Editor-3.250.0.html?&L=1)
      * [ PCAN-Symbol Editor 6 ](PCAN-Symbol-Editor-6.416.0.html?&L=1)
      * [ PEAK-Converter ](PEAK-Converter.554.0.html?&L=1)
      * [ PEAK-Flash ](PEAK-Flash.556.0.html?&L=1)
      * [ PEAK System Information ](PEAK-System-Information.557.0.html?&L=1)
    * [ PCAN-Explorer ](PCAN-Explorer.362.0.html?&L=1)
      * [ PCAN-Explorer 6 ](PCAN-Explorer-6.415.0.html?&L=1)
      * [ PE6: Plotter Add-in 6 ](PE6-Plotter-Add-in-6.417.0.html?&L=1)
      * [ PE6: Instruments Panel Add-in 6 ](PE6-Instruments-Panel-Add-in-6.418.0.html?&L=1)
      * [ PE6: CANdb Import Add-in 6 ](PE6-CANdb-Import-Add-in-6.419.0.html?&L=1)
      * [ PE6: J1939 Add-in 6 ](PE6-J1939-Add-in-6.420.0.html?&L=1)
      * [ Plot Viewer ](Plot-Viewer.552.0.html?&L=1)
    * [ Third Party Software ](Third-Party-Software.549.0.html?&L=1)
      * [ MathWorks ](MathWorks.376.0.html?&L=1)
      * [ CAN Bus Connection for DASYLab ](CAN-Bus-Connection-for-DASYLab.533.0.html?&L=1)
      * [ CAN Bus Connection for Sumac ](CAN-Bus-Connection-for-Sumac.542.0.html?&L=1)
      * [ CAN Bus Connection for T1 from GLIWA ](CAN-Bus-Connection-for-T1-from-GLIW.567.0.html?&L=1)
      * [ CAN Bus Extension for impulse ](CAN-Bus-Extension-for-impulse.484.0.html?&L=1)
      * [ LabVIEW CAN/LIN Drivers ](LabVIEW-CAN-LIN-Drivers.255.0.html?&L=1)
      * [ QNX driver ](QNX-driver.261.0.html?&L=1)
      * [ MacCAN ](MacCAN.336.0.html?&L=1)
    * [ CANopen ](CANopen.257.0.html?&L=1)
      * [ CANopen Magic ](CANopen-Magic.258.0.html?&L=1)


####  [ PCAN-Symbol Editor 3 ](PCAN-Symbol-Editor-3.250.0.html?&L=1)


[ ![](typo3temp/pics/212ebf5cae.jpg) ](CAN-FD-Frame-Analyzer.563.0.html?&L=1)


    * [ Topics ](/topics)
    * [ Trending ](/trending)
    * [ Collections ](/collections)


Best Regards


This is a basic driver node for ROS which builds an interface to control
multiple [ ODrive ](https://odriverobotics.com) motor controllers through a
CAN bus. This driver depends on [ socketcan_bridge
](http://wiki.ros.org/socketcan_bridge) package to connect to physical CAN
bus.


** Jenkins jobs  (10) **


##  [ Releases ](/belovictor/odrive_can_ros_driver/releases)


Privacy PolicyLearn more
Got it!
PEAK-System Forum
Support, Knowledge Base, and FAQ (want to sign in as new user? please send a E-Mail to support[at]peak-system.com)


		// blocks on read descriptor
		int err = select(fd+1, &fds, NULL, NULL, NULL);
		if (err != 1 || !FD_ISSET(fd, &fds)) {
			printf("select(%xh) failure: %d\n", pcan_device, err);
			break;
		}
		std::cout << "No err" << std::endl;


Generic CAN interface description with helpers for filtering and driver
implementation. Further a socketcan implementation based on boost::asio is
included.


* Solutions


[ ![](typo3temp/pics/79b6207025.jpg) ](LabVIEW-CAN-LIN-
Drivers.255.0.html?&L=1)


[ config ](/belovictor/odrive_can_ros_driver/tree/main/config "config")


Skip to content


        * [ PCAN-MiniDisplay ](PCAN-MiniDisplay.389.0.html?&L=1)
    * [ Software ](Software.68.0.html?&L=1)
      * [ Development Packages ](Development-Packages.233.0.html?&L=1)
        * [ PCAN-Basic ](PCAN-Basic.239.0.html?&L=1)
        * [ PCAN-Developer 4 ](PCAN-Developer-4.461.0.html?&L=1)
        * [ PCAN-RP1210 API ](PCAN-RP1210-API.241.0.html?&L=1)
        * [ PCAN-CCP API ](PCAN-CCP-API.289.0.html?&L=1)
        * [ PCAN-XCP API ](PCAN-XCP-API.445.0.html?&L=1)
        * [ PCAN-PassThru API ](PCAN-PassThru-API.405.0.html?&L=1)
        * [ PCAN-ISO-TP API ](PCAN-ISO-TP-API.369.0.html?&L=1)
        * [ PCAN-UDS API ](PCAN-UDS-API.370.0.html?&L=1)
        * [ PCAN-OBD-2 API ](PCAN-OBD-2-API.371.0.html?&L=1)
        * [ PLIN-API ](PLIN-API.444.0.html?&L=1)
      * [ PC Software ](PC-Software.234.0.html?&L=1)
        * [ PCAN-View ](PCAN-View.242.0.html?&L=1)
        * [ PLIN-View Pro ](PLIN-View-Pro.243.0.html?&L=1)
        * [ PCAN-OBD-2 Viewer ](PCAN-OBD-2-Viewer.535.0.html?&L=1)
        * [ Virtual PCAN-Gateway ](Virtual-PCAN-Gateway.390.0.html?&L=1)
        * [ Bit Rate Calculation Tool ](Bit-Rate-Calculation-Tool.496.0.html?&L=1)
        * [ CAN FD Frame Analyzer ](CAN-FD-Frame-Analyzer.563.0.html?&L=1)
        * [ PCAN-MicroMod Configuration ](PCAN-MicroMod-Configuration.244.0.html?&L=1)
        * [ PCAN-MicroMod FD Configuration ](PCAN-MicroMod-FD-Configuration.513.0.html?&L=1)
        * [ Thermocouple Configuration ](Thermocouple-Configuration.550.0.html?&L=1)
        * [ Thermocouple FD Configuration ](Thermocouple-FD-Configuration.551.0.html?&L=1)
        * [ PPCAN-Editor 2 ](PPCAN-Editor-2.245.0.html?&L=1)
        * [ PCAN-Linux ](PCAN-Linux.358.0.html?&L=1)
        * [ PCAN-FMS Simulator 2 ](PCAN-FMS-Simulator-2.246.0.html?&L=1)
        * [ PCAN-Trace ](PCAN-Trace.247.0.html?&L=1)
        * [ PEAK-Trace Splitter ](PEAK-Trace-Splitter.555.0.html?&L=1)
        * [ PCAN-Symbol Editor 3 ](PCAN-Symbol-Editor-3.250.0.html?&L=1)
        * [ PCAN-Symbol Editor 6 ](PCAN-Symbol-Editor-6.416.0.html?&L=1)
        * [ PEAK-Converter ](PEAK-Converter.554.0.html?&L=1)
        * [ PEAK-Flash ](PEAK-Flash.556.0.html?&L=1)
        * [ PEAK System Information ](PEAK-System-Information.557.0.html?&L=1)
      * [ PCAN-Explorer ](PCAN-Explorer.362.0.html?&L=1)
        * [ PCAN-Explorer 6 ](PCAN-Explorer-6.415.0.html?&L=1)
        * [ PE6: Plotter Add-in 6 ](PE6-Plotter-Add-in-6.417.0.html?&L=1)
        * [ PE6: Instruments Panel Add-in 6 ](PE6-Instruments-Panel-Add-in-6.418.0.html?&L=1)
        * [ PE6: CANdb Import Add-in 6 ](PE6-CANdb-Import-Add-in-6.419.0.html?&L=1)
        * [ PE6: J1939 Add-in 6 ](PE6-J1939-Add-in-6.420.0.html?&L=1)


####  [ CAN Bus Connection for DASYLab® ](CAN-Bus-Connection-for-
DASYLab.533.0.html?&L=1)


			if (usleep(1000000))
				break;


[ Software for Simulating CAN Data According to the FMS Standard ](PCAN-FMS-
Simulator-2.246.0.html?&L=1)


* **kinetic:** _Documentation generated on May 14, 2021 at 10:56 AM_ ( [ doc job ](https://build.ros.org/view/Kdoc/job/Kdoc__ros_canopen__ubuntu_xenial_amd64) ).


|

##  Preparation


[ belovictor ](/belovictor) /  **[ odrive_can_ros_driver
](/belovictor/odrive_can_ros_driver) ** Public


{{ message }}


  * [ catkin ](/catkin?distro=melodic)
  * [ class_loader ](/class_loader?distro=melodic)


  Known Bugs  #

See the project [ bug tracker ](https://github.com/hardbyte/python-can/issues)
on github. Patches and pull requests very welcome!

Documentation generated

Dec 12, 2023

[ Next  Installation  ](installation.html)

Copyright ©

Made with [ Sphinx ](https://www.sphinx-doc.org/) and [ @pradyunsg
](https://pradyunsg.me) 's [ Furo ](https://github.com/pradyunsg/furo)

[ ](https://readthedocs.org/projects/python-can) [
](https://github.com/hardbyte/python-can)

On this page

  * python-can
    * Known Bugs


  * [ catkin ](/catkin?distro=noetic)
  * [ class_loader ](/class_loader?distro=noetic)


Privacy | Terms


* [ GitHub Sponsors  Fund open source developers  ](/sponsors)


####  [ Plot Viewer ](Plot-Viewer.552.0.html?&L=1)


  * **[ Code API ](http://docs.ros.org/en/kinetic/api/socketcan_interface/html) **
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:socketcan_interface/page:1/)
  * [ Changelog ](http://docs.ros.org/en/kinetic/changelogs/socketcan_interface/changelog.html)
  * [ Change List ](/ros_canopen/ChangeList)
  * [ Reviews ](/socketcan_interface/Reviews)


[ ![](typo3temp/pics/0408672052.jpg) ](PCAN-RP1210-API.241.0.html?&L=1)


  * [ catkin ](/catkin?distro=lunar)
  * [ class_loader ](/class_loader?distro=lunar)


####  Statistics:


Further options are availabe, please consult [ SocketCAN Readme, section 6.5
](https://www.kernel.org/doc/Documentation/networking/can.txt) . For automatic
set-up, the network can be configured in _/etc/network/interfaces_ , e.g.:


  * [ ](Login.80.0.html?&L=1)
  * [ ](Search.74.0.html?&L=1)


_**[ ros_canopen ](/ros_canopen?distro=lunar) ** : [ can_msgs
](/can_msgs?distro=lunar) | [ canopen_402 ](/canopen_402?distro=lunar) | [
canopen_chain_node ](/canopen_chain_node?distro=lunar) | [ canopen_master
](/canopen_master?distro=lunar) | [ canopen_motor_node
](/canopen_motor_node?distro=lunar) | [ socketcan_bridge
](/socketcan_bridge?distro=lunar) | socketcan_interface _


			continue;
		}


[ ![](typo3temp/pics/2494a362b1.jpg) ](PCAN-OBD-2-Viewer.535.0.html?&L=1)


Documented


[ API Implementation of the CAN Calibration Protocol ](PCAN-CCP-
API.289.0.html?&L=1)


###  socketcan_dump


[ Specific CANopen Solutions for PEAK Hardware Products ](Embedded-CANopen-
Library.467.0.html?&L=1)


[ ![](typo3temp/pics/ab5e2a73f8.jpg) ](Thermocouple-FD-
Configuration.551.0.html?&L=1)


[ ![](typo3temp/pics/e2f205ca35.jpg) ](Virtual-PCAN-Gateway.390.0.html?&L=1)


[ Calculation of Register Values for CAN and CAN FD Bit Rates ](Bit-Rate-
Calculation-Tool.496.0.html?&L=1)


melodic  noetic  _Show EOL distros:_


        * [ Version 5.3.4 ](Version-5-3-4.345.0.html?&L=1)
        * [ Version 5.3.3 ](Version-5-3-3.338.0.html?&L=1)
        * [ Version 5.3.2 ](Version-5-3-2.313.0.html?&L=1)
        * [ Version 5.3.1 ](Version-5-3-1.303.0.html?&L=1)
        * [ Version 5.3.0 ](Version-5-3-0.301.0.html?&L=1)
        * [ Version 5.2.2 ](Version-5-2-2.296.0.html?&L=1)
        * [ Version 5.2.1 ](Version-5-2-1.294.0.html?&L=1)
        * [ Version 5.2.0 ](Version-5-2-0.281.0.html?&L=1)
        * [ Version 5.1.4 ](Version-5-1-4.160.0.html?&L=1)
        * [ Version 5.1.3 ](Version-5-1-3.159.0.html?&L=1)
        * [ Version 5.1.2 ](Version-5-1-2.158.0.html?&L=1)
        * [ Version 5.1.1 ](Version-5-1-1.157.0.html?&L=1)
        * [ Version 5.1.0 ](Version-5-1-0.156.0.html?&L=1)
        * [ Version 5.0.4 ](Version-5-0-4.155.0.html?&L=1)
        * [ Version 5.0.3 ](Version-5-0-3.154.0.html?&L=1)
        * [ Version 5.0.2 ](Version-5-0-2.153.0.html?&L=1)
        * [ Version 5 - Release ](Version-5-Release.152.0.html?&L=1)
      * [ PCAN-Explorer 5 Add-ins ](PCAN-Explorer-5-Add-ins.163.0.html?&L=1)
        * [ Plotter Add-in 2 ](Plotter-Add-in-2.131.0.html?&L=1)
        * [ Instruments Panel Add-in 3 ](Instruments-Panel-Add-in-3.118.0.html?&L=1)
        * [ CANdb Import Add-in 3 ](CANdb-Import-Add-in-3.130.0.html?&L=1)
        * [ J1939 Add-in ](J1939-Add-in.132.0.html?&L=1)
      * [ PCAN-Explorer 4 ](PCAN-Explorer-4.109.0.html?&L=1)
        * [ Version 4.0.15 ](Version-4-0-15.174.0.html?&L=1)
        * [ Version 4.0.14 ](Version-4-0-14.175.0.html?&L=1)
        * [ Version 4.0.13 ](Version-4-0-13.176.0.html?&L=1)
        * [ Version 4.0.10 ](Version-4-0-10.177.0.html?&L=1)
        * [ Version 4.0.9 ](Version-4-0-9.178.0.html?&L=1)
        * [ Version 4.0.6 ](Version-4-0-6.179.0.html?&L=1)
        * [ Version 4.0.5 ](Version-4-0-5.173.0.html?&L=1)
        * [ Version 4.0.4 ](Version-4-0-4.172.0.html?&L=1)
        * [ Version 4.0.3 ](Version-4-0-3.171.0.html?&L=1)
    * [ Hardware Information ](Hardware-Information.145.0.html?&L=1)
      * [ Driver Information ](Driver-Information.181.0.html?&L=1)
        * [ Supported Operating Systems ](Supported-Operating-Systems.182.0.html?&L=1)
        * [ CAN Device Driver 4.x ](CAN-Device-Driver-4-x.403.0.html?&L=1)
        * [ CAN Device Driver 3.x ](CAN-Device-Driver-3-x.183.0.html?&L=1)
        * [ CAN Device Driver 2.x ](CAN-Device-Driver-2-x.124.0.html?&L=1)
        * [ CAN Device Driver CE 6.x ](CAN-Device-Driver-CE-6-x.184.0.html?&L=1)
        * [ CAN Device Driver Linux ](CAN-Device-Driver-Linux.190.0.html?&L=1)


Wiki: socketcan_interface (last edited 2020-10-28 19:30:11 by  [
ConnorAnderson ](/ConnorAnderson "ConnorAnderson @
c-73-158-168-76.hsd1.ca.comcast.net\[73.158.168.76\]") )


[ ![PEAK-System](style/images/PEAK-System_Logo.png) ](https://www.peak-
system.com/?&L=1)


####  [ PE6: Instruments Panel Add-in 6 ](PE6-Instruments-Panel-Add-
in-6.418.0.html?&L=1)


[ ![](typo3temp/pics/c5adf6c7c9.jpg) ](PCAN-MicroMod-
Configuration.244.0.html?&L=1)


	// get the device from the cmd line if provided
	if (argc > 1) {
		char *endptr;
		unsigned long tmp = strtoul(argv[1], &endptr, 0);
		if (*endptr == '\0')
			pcan_device = tmp;
	}


    * [ ![Deutsch](typo3conf/ext/sr_language_menu/flags/de.png) Deutsch ](Software.68.0.html)
    * [ ![English](typo3conf/ext/sr_language_menu/flags/en.png) **English** ](Software.68.0.html?&L=1)
    * [ ![Français](typo3conf/ext/sr_language_menu/flags/fr.png) Français ](Software.68.0.html?&L=2)


** Dependencies  (2) **


		if (Status != PCAN_ERROR_OK) {
			printf("CAN_Read(%xh) failure 0x%x\n", pcan_device, (int) Status);
			break;
		}


* **indigo:** _Documentation generated on June 07, 2019 at 04:31 AM_ ( [ doc job ](http://build.ros.org/view/Idoc/job/Idoc__ros_canopen__ubuntu_trusty_amd64) ).


[ ![](typo3temp/pics/da2ccba5a3.jpg) ](CANopen-Controller-
Library.482.0.html?&L=1)


We use cookies on our website to provide you with the best possible service
and to further improve our website. By clicking the "Accept All" button, you
agree to the use of all cookies. You can limit the cookies used by clicking on
"Accept selection". Further information and an option to revoke your selection
can be found in our [ privacy policy ](https://www.peak-system.com/Privacy-
Policy.483.0.html?&L=1) .


			if (usleep(1000000))
				break;


|

[ esd electronic system design gmbh ](https://esd.eu)


  * [ Distributions ](/Distributions)
  * [ ROS/Installation ](/ROS/Installation)
  * [ ROS/Tutorials ](/ROS/Tutorials)
  * [ RecentChanges ](/RecentChanges)
  * [ socketcan_interface ](/socketcan_interface)


printf("pcaneventread(%xh): received %u message(s)\n", pcan_device, rx_count);


  * [ Home ](Home.59.0.html?&L=1)
    * [ News Archive ](News-Archive.61.0.html?&L=1)
    * [ Events ](Events.115.0.html?&L=1)
    * [ International Sales Partners ](International-Sales-Partners.293.0.html?&L=1)
    * [ Press Portal ](Press-Portal.112.0.html?&L=1)
  * [ Company ](Company.58.0.html?&L=1)
    * [ Profile ](Profile.66.0.html?&L=1)
    * [ Quality and Environment ](Quality-and-Environment.400.0.html?&L=1)
    * [ Partners ](Partners.64.0.html?&L=1)
    * [ Memberships ](Memberships.506.0.html?&L=1)
    * [ References ](References.65.0.html?&L=1)
  * [ Products ](Products.57.0.html?&L=1)
    * [ Product Overview ](Product-Overview.333.0.html?&L=1)
    * [ Hardware ](Hardware.69.0.html?&L=1)
      * [ PC Interfaces ](PC-Interfaces.196.0.html?&L=1)
        * [ PCAN-USB ](PCAN-USB.199.0.html?&L=1)
        * [ PCAN-USB FD ](PCAN-USB-FD.365.0.html?&L=1)
        * [ PCAN-USB Pro FD ](PCAN-USB-Pro-FD.366.0.html?&L=1)
        * [ PCAN-USB X6 ](PCAN-USB-X6.438.0.html?&L=1)
        * [ PLIN-USB ](PLIN-USB.485.0.html?&L=1)
        * [ PCAN-PCI ](PCAN-PCI.207.0.html?&L=1)
        * [ PCAN-PCI Express ](PCAN-PCI-Express.206.0.html?&L=1)
        * [ PCAN-PCI Express FD ](PCAN-PCI-Express-FD.414.0.html?&L=1)
        * [ PCAN-miniPCI ](PCAN-miniPCI.205.0.html?&L=1)
        * [ PCAN-miniPCIe ](PCAN-miniPCIe.285.0.html?&L=1)
        * [ PCAN-miniPCIe FD ](PCAN-miniPCIe-FD.464.0.html?&L=1)
        * [ PCAN-M.2 ](PCAN-M-2.473.0.html?&L=1)
        * [ PCAN-PC/104 ](PCAN-PC-104.210.0.html?&L=1)
        * [ PCAN-PC/104-Plus ](PCAN-PC-104-Plus.209.0.html?&L=1)
        * [ PCAN-PC/104-Plus Quad ](PCAN-PC-104-Plus-Quad.286.0.html?&L=1)
        * [ PCAN-PCI/104-Express ](PCAN-PCI-104-Express.208.0.html?&L=1)
        * [ PCAN-PCI/104-Express FD ](PCAN-PCI-104-Express-FD.474.0.html?&L=1)
        * [ PCAN-ExpressCard 34 ](PCAN-ExpressCard-34.367.0.html?&L=1)
        * [ PCAN-ExpressCard ](PCAN-ExpressCard.202.0.html?&L=1)
        * [ PCAN-PC Card ](PCAN-PC-Card.203.0.html?&L=1)
        * [ PCAN-ISA ](PCAN-ISA.211.0.html?&L=1)
        * [ PCAN-Dongle ](PCAN-Dongle.212.0.html?&L=1)
      * [ Chip Solutions ](Chip-Solutions.440.0.html?&L=1)
        * [ PCAN-Chip PCIe FD ](PCAN-Chip-PCIe-FD.443.0.html?&L=1)
        * [ PCAN-Chip USB & Eval ](PCAN-Chip-USB-Eval.441.0.html?&L=1)


			continue;
		}
And you can see that the second print doesn't appears in the terminal.
Screenshot from 2021-12-16 12-49-12.png
Screenshot from 2021-12-16 12-49-12.png (23.26 KiB) Viewed 2680 times
Top
angux
Posts: 5
Joined: Tue 14. Dec 2021, 14:34
Re: Crash on Read/Write PCANBasic
Post by angux » Thu 16. Dec 2021, 13:01


**Package Links**


    allow-hotplug can0
    iface can0 can static
        bitrate 500000
    #    up ip link set $IFACE txqueuelen 20 # uncomment if more than 4 nodes are used


[ PC Interface Driver for Linux ](PCAN-Linux.358.0.html?&L=1)


#ifndef NO_RT
	mlockall(MCL_CURRENT | MCL_FUTURE);


Released


[ RP1210 Connectivity to PEAK CAN Interfaces and RP1210 API ](PCAN-
RP1210-API.241.0.html?&L=1)


####  [ PCAN-OBD-2 API ](PCAN-OBD-2-API.371.0.html?&L=1)


  * [ catkin ](/catkin?distro=jade)
  * [ class_loader ](/class_loader?distro=jade)


The ROS Wiki is for ROS 1. Are you using ROS 2 ( [ Humble
](http://docs.ros.org/en/humble/) , [ Iron ](http://docs.ros.org/en/iron/) ,
or [ Rolling ](http://docs.ros.org/en/rolling/) )?
[ Check out the ROS 2 Project Documentation ](http://docs.ros.org)
Package specific documentation can be found on [ index.ros.org
](https://index.ros.org)


The following devices were tested with socketcan_interface:


####  [ PE6: CANdb Import Add-in 6 ](PE6-CANdb-Import-Add-
in-6.419.0.html?&L=1)


		if (Status != PCAN_ERROR_OK) {
			printf("CAN_Read(%xh) failure 0x%x\n", pcan_device, (int) Status);
			break;
		}


Toggle navigation


###  Load driver


##  Usage


[ ](Products.57.0.html?&L=1 "Your basket is empty.")


Status


_EOL distros:_ indigo  jade  kinetic  lunar


This driver was successfully tested with multiple [ ODrive
](https://odriverobotics.com) controllers on a CAN bus connected to [
Raspberry Pi 4 ](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/)
through [ Waveshare CAN hat ](https://www.waveshare.com/rs485-can-hat.htm) on
Ubuntu 18.04 and 20.04 with ROS melodic and noetic.


[ ![](/custom/images/brought_by_horiz.png) ](https://www.openrobotics.org/)


####  [ CANopen Magic ](CANopen-Magic.258.0.html?&L=1)


[ ![](typo3temp/pics/537bdd97f5.png) ](CAN-Bus-Extension-for-
impulse.484.0.html?&L=1)


####  [ PCAN-View ](PCAN-View.242.0.html?&L=1)


####  [ CAN Bus Extension for impulse ](CAN-Bus-Extension-for-
impulse.484.0.html?&L=1)


lbl_close:
	CAN_Uninitialize(pcan_device);


I tried with declaring the message variable as you said:


#  Search code, repositories, users, issues, pull requests...


Clear


printf("Entering infinite loop (reading MSG[ID:0xff LEN:1 DATA[0]:0xff] breaks it)...\n");


Search this topic…
7 posts • Page 1 of 1
angux
Posts: 5
Joined: Tue 14. Dec 2021, 14:34
Crash on Read/Write PCANBasic
Post by angux » Tue 14. Dec 2021, 15:34


Skip to content


[ ![](typo3temp/pics/b65816b152.jpg) ](PE6-CANdb-Import-Add-
in-6.419.0.html?&L=1)


![](style/images/Zertifizierter_Microsoft_Partner.png) [
![](style/images/Premiumsponsor_Lilien.png) ](https://www.peak-
group.de/de/peak98/konzept)


No releases published


ROS driver for the [ ODrive ](https://odriverobotics.com) motor controller
connecting through CAN bus


Simple test program provided with the package, just prints the received
messages:


Topic name  |  Message type  |  Direction  |  Description
---|---|---|---
` <axis name>/angle ` |  ` std_msgs/Float64 ` |  Outbound  |  Angle of the
axis in rad
` <axis name>/current ` |  ` std_msgs/Float64 ` |  Outbound  |  Axis current
consumption
` <axis name>/current_velocity ` |  ` std_msgs/Float64 ` |  Outbound  |
Current axis angular velocity in rad/s
` <axis name>/output_velocity ` |  ` std_msgs/Float64 ` |  Outbound  |
Velocity which is sent to ODrive (will differ from target_velocity if
axis_min_velocity is set)
` <axis name>/target_velocity ` |  ` std_msgs/Float64 ` |  Inbound  |  Target
axis angular velocity in rad/s
` <axis name>/voltage ` |  ` std_msgs/Float64 ` |  Outbound  |  Axis voltage
of power supply in V

So basically you can control every axis by setting the target velocity and
monitor axis activity/performance through current angle and velocity and also
monitor power supply and consumption through voltage and current.


###  Getting the code


**Package Links**


[ Windows Software for Splitting Trace Data ](PEAK-Trace-
Splitter.555.0.html?&L=1)


Necessary


	FD_ZERO(&fds);
	FD_SET(fd, &fds);


  * [ canopen_chain_node ](/canopen_chain_node?distro=jade)
  * [ canopen_master ](/canopen_master?distro=jade)
  * [ ros_canopen ](/ros_canopen?distro=jade)
  * [ socketcan_bridge ](/socketcan_bridge?distro=jade)


[ Sign up
](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-
name%3E%2F%3Crepo-name%3E&source=header-
repo&source_repo=belovictor%2Fodrive_can_ros_driver)


* **melodic:** _Documentation generated on March 01, 2022 at 07:23 AM_ ( [ doc job ](https://build.ros.org/view/Mdoc/job/Mdoc__ros_canopen__ubuntu_bionic_amd64) ).


  * [ C++  73.3%  ](/belovictor/odrive_can_ros_driver/search?l=c%2B%2B)
  * [ CMake  26.7%  ](/belovictor/odrive_can_ros_driver/search?l=cmake)


[ package.xml ](/belovictor/odrive_can_ros_driver/blob/main/package.xml
"package.xml")


####  [ MacCAN ](MacCAN.336.0.html?&L=1)


** Dependencies  (2) **


Released


####  [ QNX Driver ](QNX-driver.261.0.html?&L=1)


TPCANMsg Message = {0};


####  [ Thermocouple FD Configuration ](Thermocouple-FD-
Configuration.551.0.html?&L=1)


  * Maintainer status: maintained
  * Maintainer: Mathias Lüdtke <mathias.luedtke AT ipa.fraunhofer DOT de>
  * Author: Mathias Lüdtke <mathias.luedtke AT ipa.fraunhofer DOT de>
  * License: LGPLv3
  * Bug / feature tracker: [ https://github.com/ros-industrial/ros_canopen/issues ](https://github.com/ros-industrial/ros_canopen/issues)
  * Source: git [ https://github.com/ros-industrial/ros_canopen.git ](https://github.com/ros-industrial/ros_canopen) (branch: indigo)


PEAK-USB


The package name would depend on your ROS version. This driver has been tested
and is known to work with melodic and noetic.


#  Package Summary


[ ](Products.57.0.html?&L=1 "Your basket is empty.")


_**[ ros_canopen ](/ros_canopen?distro=melodic) ** : [ can_msgs
](/can_msgs?distro=melodic) | [ canopen_402 ](/canopen_402?distro=melodic) | [
canopen_chain_node ](/canopen_chain_node?distro=melodic) | [ canopen_master
](/canopen_master?distro=melodic) | [ canopen_motor_node
](/canopen_motor_node?distro=melodic) | [ socketcan_bridge
](/socketcan_bridge?distro=melodic) | socketcan_interface _


      * [ PCAN-MicroMod FD DR CANopen Digital 1 ](PCAN-MicroMod-FD-DR-CANopen-Digital.520.0.html?&L=1)
      * [ PCAN-MicroMod ](PCAN-MicroMod.220.0.html?&L=1)
      * [ PCAN-MicroMod Evaluation ](PCAN-MicroMod-Evaluation.221.0.html?&L=1)
      * [ PCAN-MicroMod Analog ](PCAN-MicroMod-Analog.222.0.html?&L=1)
      * [ PCAN-MicroMod Digital ](PCAN-MicroMod-Digital.223.0.html?&L=1)
      * [ PCAN-MicroMod Mix 1 & 2 ](PCAN-MicroMod-Mix-1-2.224.0.html?&L=1)
      * [ PCAN-MicroMod Mix 3 ](PCAN-MicroMod-Mix-3.226.0.html?&L=1)
      * [ PCAN-MIO ](PCAN-MIO.227.0.html?&L=1)
      * [ MU-Thermocouple1 CAN ](MU-Thermocouple1-CAN.232.0.html?&L=1)
      * [ MU-Thermocouple1 CAN FD ](MU-Thermocouple1-CAN-FD.558.0.html?&L=1)
      * [ PCAN-GPS ](PCAN-GPS.378.0.html?&L=1)
      * [ PCAN-GPS FD ](PCAN-GPS-FD.588.0.html?&L=1)
    * [ Routers & Gateways ](Routers-Gateways.198.0.html?&L=1)
      * [ PCAN-Ethernet Gateway DR ](PCAN-Ethernet-Gateway-DR.330.0.html?&L=1)
      * [ PCAN-Ethernet Gateway FD DR ](PCAN-Ethernet-Gateway-FD-DR.538.0.html?&L=1)
      * [ Virtual PCAN-Gateway ](Virtual-PCAN-Gateway.582.0.html?&L=1)
      * [ PCAN-LIN ](PCAN-LIN.213.0.html?&L=1)
      * [ PCAN-RS-232 ](PCAN-RS-232.287.0.html?&L=1)
      * [ PCAN-Router ](PCAN-Router.228.0.html?&L=1)
      * [ PCAN-Router FD ](PCAN-Router-FD.406.0.html?&L=1)
      * [ PCAN-Router DR ](PCAN-Router-DR.315.0.html?&L=1)
      * [ PCAN-Router Pro ](PCAN-Router-Pro.229.0.html?&L=1)
      * [ PCAN-Router Pro FD ](PCAN-Router-Pro-FD.511.0.html?&L=1)
    * [ Diagnostics & Education ](Diagnostics-Education.319.0.html?&L=1)
      * [ PCAN-Diag 2 ](PCAN-Diag-2.231.0.html?&L=1)
      * [ PCAN-Diag FD ](PCAN-Diag-FD.456.0.html?&L=1)
      * [ PCAN-Diag FD J1939 Add-in ](PCAN-Diag-FD-J1939-Add-in.579.0.html?&L=1)
      * [ PCAN-MiniDiag FD ](PCAN-MiniDiag-FD.490.0.html?&L=1)
      * [ PCAN-MiniDisplay ](PCAN-MiniDisplay.389.0.html?&L=1)
  * [ Software ](Software.68.0.html?&L=1)
    * [ Development Packages ](Development-Packages.233.0.html?&L=1)
      * [ PCAN-Basic ](PCAN-Basic.239.0.html?&L=1)
      * [ PCAN-Developer 4 ](PCAN-Developer-4.461.0.html?&L=1)
      * [ PCAN-RP1210 API ](PCAN-RP1210-API.241.0.html?&L=1)
      * [ PCAN-CCP API ](PCAN-CCP-API.289.0.html?&L=1)
      * [ PCAN-XCP API ](PCAN-XCP-API.445.0.html?&L=1)
      * [ PCAN-PassThru API ](PCAN-PassThru-API.405.0.html?&L=1)
      * [ PCAN-ISO-TP API ](PCAN-ISO-TP-API.369.0.html?&L=1)
      * [ PCAN-UDS API ](PCAN-UDS-API.370.0.html?&L=1)
      * [ PCAN-OBD-2 API ](PCAN-OBD-2-API.371.0.html?&L=1)


####  [ PCAN-UDS API ](PCAN-UDS-API.370.0.html?&L=1)


The SocketCAN driver interface is based on [ Boost.Asio
](http://www.boost.org/doc/libs/release/doc/html/boost_asio.html) and provides
concurrent access to SocketCAN interfaces. It is the default CAN
implementation used throughout ros_canopen and requires Linux kerner 2.6.25 or
newer.


  * [ Contact ](Contact.54.0.html?&L=1)
  * [ Imprint ](Imprint.51.0.html?&L=1)
  * [ Privacy Policy ](Privacy-Policy.483.0.html?&L=1)
  * [ General Terms of Business ](General-Terms-of-Business.60.0.html?&L=1 "PEAK-System Technik GmbH – General Terms of Business ")
  * [ Sitemap ](Sitemap.52.0.html?&L=1)
  * [ PEAK Group ](https://www.peak-group.de/en/)


    sudo modprobe peak_usb # kernel driver, since 3.11

    sudo modprobe peak_pci # kernel driver

    sudo modprobe pcan # PEAK vendor driver

    sudo modprobe esd_usb2 # kernel driver


	int fd;
	Status = CAN_GetValue(pcan_device, PCAN_RECEIVE_EVENT, &fd, sizeof fd);
	printf("CAN_GetValue(%xh): Status=0x%x\n", pcan_device, (int)Status);
	if (Status)
		goto lbl_close;


###  Resources


_**[ ros_canopen ](/ros_canopen?distro=noetic) ** : [ can_msgs
](/can_msgs?distro=noetic) | [ canopen_402 ](/canopen_402?distro=noetic) | [
canopen_chain_node ](/canopen_chain_node?distro=noetic) | [ canopen_master
](/canopen_master?distro=noetic) | [ canopen_motor_node
](/canopen_motor_node?distro=noetic) | [ socketcan_bridge
](/socketcan_bridge?distro=noetic) | socketcan_interface _


** Dependencies  (2) **


[ Sign in
](/login?return_to=https%3A%2F%2Fgithub.com%2Fbelovictor%2Fodrive_can_ros_driver)


while (1) {


[ ![ros.org](/custom/images/ros_org.png) ](/) |  [ About
](http://www.ros.org/about-ros) | [ Support ](/Support) | [ Discussion Forum
](http://discourse.ros.org/) | [ Index ](http://index.ros.org/) | [ Service
Status ](http://status.ros.org/) | [ ros @ Robotics Stack Exchange
](https://robotics.stackexchange.com/questions/tagged/ros)
---|---
![](/custom/images/menu_left.png) [
![Documentation](/custom/images/menu_documentation.png) ](/)
![](/custom/images/menu_spacer.png) [ ![Browse
Software](/custom/images/menu_browse_software.png)
](https://index.ros.org/packages) ![](/custom/images/menu_spacer.png) [
![News](/custom/images/menu_news.png) ](https://discourse.ros.org/c/general)
![](/custom/images/menu_spacer.png) [
![Download](/custom/images/menu_download.png) ](/ROS/Installation)
![](/custom/images/menu_right.png)

  * [ socketcan_interface ](/socketcan_interface)


Hello, thanks for the response.


###  How it works?


Released


        * [ Version 6.6.0 ](Version-6-6-0.570.0.html?&L=1)
        * [ Version 6.5.2 ](Version-6-5-2.569.0.html?&L=1)
        * [ Version 6.5.1 ](Version-6-5-1.568.0.html?&L=1)
        * [ Version 6.5.0 ](Version-6-5-0.534.0.html?&L=1)
        * [ Version 6.4.1 ](Version-6-4-1.532.0.html?&L=1)
        * [ Version 6.4.0 ](Version-6-4-0.517.0.html?&L=1)
        * [ Version 6.3.6 ](Version-6-3-6.512.0.html?&L=1)
        * [ Version 6.3.5 ](Version-6-3-5.507.0.html?&L=1)
        * [ Version 6.3.4 ](Version-6-3-4.504.0.html?&L=1)
        * [ Version 6.3.3 ](Version-6-3-3.502.0.html?&L=1)
        * [ Version 6.3.2 ](Version-6-3-2.499.0.html?&L=1)
        * [ Version 6.3.1 ](Version-6-3-1.494.0.html?&L=1)
        * [ Version 6.3.0 ](Version-6-3-0.489.0.html?&L=1)
        * [ Version 6.2.2 ](Version-6-2-2.487.0.html?&L=1)
        * [ Version 6.2.1 ](Version-6-2-1.486.0.html?&L=1)
        * [ Version 6.2.0 ](Version-6-2-0.481.0.html?&L=1)
        * [ Version 6.1.1 ](Version-6-1-1.471.0.html?&L=1)
        * [ Version 6.1.0 ](Version-6-1-0.462.0.html?&L=1)
        * [ Version 6.0.12 ](Version-6-0-12.457.0.html?&L=1)
        * [ Version 6.0.11 ](Version-6-0-11.452.0.html?&L=1)
        * [ Version 6.0.10 ](Version-6-0-10.450.0.html?&L=1)
        * [ Version 6.0.9 ](Version-6-0-9.449.0.html?&L=1)
        * [ Version 6.0.8 ](Version-6-0-8.447.0.html?&L=1)
        * [ Version 6.0.7 ](Version-6-0-7.446.0.html?&L=1)
        * [ Version 6.0.6 ](Version-6-0-6.442.0.html?&L=1)
        * [ Version 6.0.5 ](Version-6-0-5.439.0.html?&L=1)
        * [ Version 6.0.4 ](Version-6-0-4.437.0.html?&L=1)
        * [ Version 6.0.3 ](Version-6-0-3.436.0.html?&L=1)
        * [ Version 6.0.2 ](Version-6-0-2.432.0.html?&L=1)
        * [ Version 6 - Release ](Version-6-Release.422.0.html?&L=1)
      * [ PCAN-Explorer 6 Add-ins ](PCAN-Explorer-6-Add-ins.423.0.html?&L=1)
        * [ Plotter Add-in 6 ](Plotter-Add-in-6.427.0.html?&L=1)
        * [ Instruments Panel Add-in 6 ](Instruments-Panel-Add-in-6.425.0.html?&L=1)
        * [ CANdb Import Add-in 6 ](CANdb-Import-Add-in-6.424.0.html?&L=1)
        * [ J1939 Add-in 6 ](J1939-Add-in-6.426.0.html?&L=1)
      * [ PCAN-Explorer 5 ](PCAN-Explorer-5.107.0.html?&L=1)
        * [ Version 5.4.3 ](Version-5-4-3.491.0.html?&L=1)
        * [ Version 5.4.2 ](Version-5-4-2.465.0.html?&L=1)
        * [ Version 5.4.1 ](Version-5-4-1.434.0.html?&L=1)
        * [ Version 5.4.0 ](Version-5-4-0.395.0.html?&L=1)


[ package.xml ](/belovictor/odrive_can_ros_driver/blob/main/package.xml
"package.xml")


[ ![](typo3temp/pics/5607e3bdbb.jpg) ](PEAK-Converter.554.0.html?&L=1)


####  [ PCAN-Linux ](PCAN-Linux.358.0.html?&L=1)


Include my email address so I can be contacted


[ API Implementation of the OBD-2 Standard (ISO 15765-4) ](PCAN-
OBD-2-API.371.0.html?&L=1)


      * [ CANopen PC Developer Kit ](CANopen-PC-Developer-Kit.259.0.html?&L=1)
      * [ Embedded CANopen Library ](Embedded-CANopen-Library.467.0.html?&L=1)
      * [ CANopen Controller Library ](CANopen-Controller-Library.482.0.html?&L=1)
  * [ Accessories ](Accessories.67.0.html?&L=1)
    * [ Adapters ](Adapters.236.0.html?&L=1)
      * [ ISA-PC/104 Adapter ](ISA-PC-104-Adapter.267.0.html?&L=1)
      * [ PCI-PC/104-Plus Adapter ](PCI-PC-104-Plus-Adapter.268.0.html?&L=1)
      * [ PCI-Express-PCIe/104 Adapter ](PCI-Express-PCIe-104-Adapter.269.0.html?&L=1)
      * [ PCIe-miniPCIe Low-Profile Adapter ](PCIe-miniPCIe-Low-Profile-Adapter.337.0.html?&L=1)
      * [ PCIe-M.2 Low-Profile Adapter ](PCIe-M-2-Low-Profile-Adapter.574.0.html?&L=1)
      * [ PCAN-Term ](PCAN-Term.270.0.html?&L=1)
      * [ PCAN-T-Adapter ](PCAN-T-Adapter.271.0.html?&L=1)
      * [ PCAN-Adapter D-Sub for DR Products ](PCAN-Adapter-D-Sub-for-DR-Products.316.0.html?&L=1)
      * [ PCAN-Adapter D-Sub to Screw Terminals ](PCAN-Adapter-D-Sub-to-Screw-Termina.573.0.html?&L=1)
      * [ PEAK-DevPack Debug Adapter ](PEAK-DevPack-Debug-Adapter.591.0.html?&L=1)
    * [ Cables ](Cables.237.0.html?&L=1)
      * [ PCAN-Cable 1 & 2 ](PCAN-Cable-1-2.272.0.html?&L=1)
      * [ PCAN-Cable 3 ](PCAN-Cable-3.290.0.html?&L=1)
      * [ LIN Connection Cable for PCAN-LIN ](LIN-Connection-Cable-for-PCAN-LIN.291.0.html?&L=1)
      * [ LIN Connection Cable for PC LIN Interfaces ](LIN-Connection-Cable-for-PC-LIN-Int.451.0.html?&L=1)
      * [ PCAN-Cable OBD-2 ](PCAN-Cable-OBD-2.273.0.html?&L=1)
      * [ PCAN-Cable J1939 ](PCAN-Cable-J1939.377.0.html?&L=1)
      * [ PCAN-Cable M12 ](PCAN-Cable-M12.589.0.html?&L=1)
  * [ Discontinued Products ](Discontinued-Products.586.0.html?&L=1)
    * [ PCAN-USB Pro ](PCAN-USB-Pro.200.0.html?&L=1)
    * [ PCAN-USB Hub ](PCAN-USB-Hub.201.0.html?&L=1)
    * [ PCAN-cPCI ](PCAN-cPCI.204.0.html?&L=1)
    * [ PCAN-B10011S ](PCAN-B10011S.218.0.html?&L=1)
    * [ PLIN-Slave ](PLIN-Slave.274.0.html?&L=1)
    * [ PEAK-gridARM Evaluation Board ](PEAK-gridARM-Evaluation-Board.317.0.html?&L=1)
    * [ PCAN-Wireless Gateway ](PCAN-Wireless-Gateway.331.0.html?&L=1)
    * [ PCAN-Wireless Gateway DR ](PCAN-Wireless-Gateway-DR.332.0.html?&L=1)
    * [ PCAN-GPRS Link ](PCAN-GPRS-Link.230.0.html?&L=1)
    * [ Serial Bus Simulator ](Serial-Bus-Simulator.275.0.html?&L=1)
  * [ Products A - Z ](Products-A-Z.328.0.html?&L=1)
  * [ International Sales Partners ](International-Sales-Partners.329.0.html?&L=1)


[ OS X Library for the PCAN-USB CAN Interface ](MacCAN.336.0.html?&L=1)


* _StateInterface_ : Listener interface for the state of the driver


Works


** Used by  (4) **


#ifdef XENOMAI
		// force flush of printf buffers
		if (!(rx_count % 100))
			rt_print_flush_buffers();
	}


Bring-up CAN NIC (Linux kernel drivers):


Search


  * candump
  * cansend
  * canbusload


  * Build history (last 5 of 11 builds):
  * [ #39  22-Nov-2022 07:41  82 / 82  ](https://build.ros.org//job/Mdev__ros_canopen__ubuntu_bionic_amd64/39/)
  * [ #38  14-Nov-2022 10:41  82 / 82  ](https://build.ros.org//job/Mdev__ros_canopen__ubuntu_bionic_amd64/38/)
  * [ #37  11-Nov-2021 21:41  82 / 82  ](https://build.ros.org//job/Mdev__ros_canopen__ubuntu_bionic_amd64/37/)
  * [ #36  09-Jul-2021 16:41  82 / 82  ](https://build.ros.org//job/Mdev__ros_canopen__ubuntu_bionic_amd64/36/)
  * [ #35  06-May-2021 23:42  82 / 82  ](https://build.ros.org//job/Mdev__ros_canopen__ubuntu_bionic_amd64/35/)


** Dependencies  (2) **


Also, can you relay us the log-file?


    * [ Actions  Automate any workflow  ](/features/actions)
    * [ Packages  Host and manage packages  ](/features/packages)
    * [ Security  Find and fix vulnerabilities  ](/features/security)
    * [ Codespaces  Instant dev environments  ](/features/codespaces)
    * [ Copilot  Write better code with AI  ](/features/copilot)
    * [ Code review  Manage code changes  ](/features/code-review)
    * [ Issues  Plan and track work  ](/features/issues)
    * [ Discussions  Collaborate outside of code  ](/features/discussions)


[ **25** stars ](/belovictor/odrive_can_ros_driver/stargazers)


[ ![](typo3temp/pics/a49f9454ca.jpg) ](PEAK-Flash.556.0.html?&L=1)


##  Overview


[ See socketcan_interface on index.ros.org for more info including aything ROS
2 related. ](https://index.ros.org/p/socketcan_interface)


[ README.md ](/belovictor/odrive_can_ros_driver/blob/main/README.md
"README.md")


	// get the device from the cmd line if provided
	if (argc > 1) {
		char *endptr;
		unsigned long tmp = strtoul(argv[1], &endptr, 0);
		if (*endptr == '\0')
			pcan_device = tmp;
	}


[ Notifications ](/login?return_to=%2Fbelovictor%2Fodrive_can_ros_driver)


[ ![](typo3temp/pics/da2e3be9bb.jpg) ](PCAN-Trace.247.0.html?&L=1)


Continuous Integration


Additional navigation options


Works


####  [ PCAN-ISO-TP API ](PCAN-ISO-TP-API.369.0.html?&L=1)


Repositories


[ Windows software for converting trace data to various file formats ](PEAK-
Converter.554.0.html?&L=1)


Resources


lbl_exit:
#ifdef XENOMAI
#elif defined(RTAI)
	rt_make_soft_real_time();
	rt_task_delete(mainr);
#endif


#  Package Summary


[ launch ](/belovictor/odrive_can_ros_driver/tree/main/launch "launch")


Cancel  Submit feedback


TPCANMsg Message = {0};
CODE: SELECT ALL


####  [ Bit Rate Calculation Tool ](Bit-Rate-Calculation-Tool.496.0.html?&L=1)


[ Report repository ](/contact/report-
content?content_url=https%3A%2F%2Fgithub.com%2Fbelovictor%2Fodrive_can_ros_driver&report=belovictor+%28user%29)


	rt_print_flush_buffers();
#else
	}
#endif


	int fd;
	Status = CAN_GetValue(pcan_device, PCAN_RECEIVE_EVENT, &fd, sizeof fd);
	printf("CAN_GetValue(%xh): Status=0x%x\n", pcan_device, (int)Status);
	if (Status)
		goto lbl_close;


Contents  Menu  Expand  Light mode  Dark mode  Auto light/dark mode

Hide navigation sidebar

Hide table of contents sidebar

Toggle site navigation sidebar

_ _

python-can 4.3.1 documentation

Toggle Light / Dark / Auto color theme

Toggle table of contents sidebar

_ _

python-can 4.3.1 documentation

  * [ Installation ](installation.html)
  * [ Configuration ](configuration.html)
  * [ Library API ](api.html)

Toggle navigation of Library API

_ _

    * [ Bus ](bus.html)
    * [ Message ](message.html)
    * [ Reading and Writing Messages ](listeners.html)
    * [ Asyncio support ](asyncio.html)
    * [ Broadcast Manager ](bcm.html)
    * [ Error Handling ](errors.html)
    * [ Bit Timing Configuration ](bit_timing.html)
    * [ Utilities ](utils.html)
    * [ Internal API ](internal-api.html)
  * [ Hardware Interfaces ](interfaces.html)

Toggle navigation of Hardware Interfaces


    * [ Enterprise ](/enterprise)
    * [ Teams ](/team)
    * [ Startups ](/enterprise/startups)
    * [ Education  ](https://education.github.com)


[ ![](typo3temp/pics/cef256d4b4.jpg) ](PCAN-View.242.0.html?&L=1)


[ Configuration Software for PCAN-MicroMod Products ](PCAN-MicroMod-
Configuration.244.0.html?&L=1)


[ ](https://github.com/)


* README


  * [ Code  ](/belovictor/odrive_can_ros_driver)
  * [ Issues  0  ](/belovictor/odrive_can_ros_driver/issues)
  * [ Pull requests  0  ](/belovictor/odrive_can_ros_driver/pulls)
  * [ Actions  ](/belovictor/odrive_can_ros_driver/actions)
  * [ Projects  0  ](/belovictor/odrive_can_ros_driver/projects)
  * [ Security  ](/belovictor/odrive_can_ros_driver/security)
  * [ Insights  ](/belovictor/odrive_can_ros_driver/pulse)


####  [ Embedded CANopen Library ](Embedded-CANopen-Library.467.0.html?&L=1)


  * [ Notifications ](/login?return_to=%2Fbelovictor%2Fodrive_can_ros_driver)
  * [ Fork  9  ](/login?return_to=%2Fbelovictor%2Fodrive_can_ros_driver)
  * [ Star  25  ](/login?return_to=%2Fbelovictor%2Fodrive_can_ros_driver)


Yes, i created a ROS node and just copy/pasted the code and added the initialization in ros (ros::init) but that was the only change (and one include file).


Continuous Integration:  82 / 82


No packages published


      * [ PLIN-Slave ](PLIN-Slave.274.0.html?&L=1)
      * [ PEAK-gridARM Evaluation Board ](PEAK-gridARM-Evaluation-Board.317.0.html?&L=1)
      * [ PCAN-Wireless Gateway ](PCAN-Wireless-Gateway.331.0.html?&L=1)
      * [ PCAN-Wireless Gateway DR ](PCAN-Wireless-Gateway-DR.332.0.html?&L=1)
      * [ PCAN-GPRS Link ](PCAN-GPRS-Link.230.0.html?&L=1)
      * [ Serial Bus Simulator ](Serial-Bus-Simulator.275.0.html?&L=1)
    * [ Products A - Z ](Products-A-Z.328.0.html?&L=1)
    * [ International Sales Partners ](International-Sales-Partners.329.0.html?&L=1)
  * [ Services ](Services.56.0.html?&L=1)
    * [ Contract Engineering ](Contract-Engineering.83.0.html?&L=1)
    * [ CANopen ](CANopen.468.0.html?&L=1)
  * [ Support ](Support.55.0.html?&L=1)
    * [ Downloads ](Downloads.76.0.html?&L=1)
      * [ Drivers ](Drivers.523.0.html?&L=1)
      * [ Packages ](Packages.306.0.html?&L=1)
      * [ Software ](Software.305.0.html?&L=1)
      * [ Firmware ](Firmware.548.0.html?&L=1)
      * [ Development ](Development.526.0.html?&L=1)
      * [ Catalog & Prices ](Catalog-Prices.524.0.html?&L=1)
      * [ Documentation ](Documentation.341.0.html?&L=1)
      * [ Certificates ](Certificates.527.0.html?&L=1)
      * [ Videos ](Videos.116.0.html?&L=1)
    * [ Product DVD ](Product-DVD.349.0.html?&L=1)
    * [ Software Information ](Software-Information.77.0.html?&L=1)
      * [ Development Packages ](Development-Packages.187.0.html?&L=1)
        * [ PCAN-API 4 ](PCAN-API-4.562.0.html?&L=1)
        * [ PCAN-API 2 ](PCAN-API-2.123.0.html?&L=1)
        * [ PCAN-Basic ](PCAN-Basic.126.0.html?&L=1)
        * [ PCAN-Basic Linux ](PCAN-Basic-Linux.433.0.html?&L=1)
        * [ PCAN-Light ](PCAN-Light.125.0.html?&L=1)
        * [ PCAN-CE API ](PCAN-CE-API.127.0.html?&L=1)
        * [ PCAN-Developer 4 ](PCAN-Developer-4.460.0.html?&L=1)
        * [ PCAN-Developer 3 ](PCAN-Developer-3.141.0.html?&L=1)
        * [ PCAN-RP1210-A ](PCAN-RP1210-A.143.0.html?&L=1)
        * [ PCAN-RP1210-C ](PCAN-RP1210-C.361.0.html?&L=1)
        * [ PCAN-CCP API ](PCAN-CCP-API.298.0.html?&L=1)
        * [ PCAN-XCP API ](PCAN-XCP-API.334.0.html?&L=1)
        * [ PCAN-PassThru API ](PCAN-PassThru-API.404.0.html?&L=1)
        * [ PCAN-ISO-TP API ](PCAN-ISO-TP-API.372.0.html?&L=1)
        * [ PCAN-UDS API ](PCAN-UDS-API.373.0.html?&L=1)


####  [ CAN Bus Connection for T1 from GLIWA ](CAN-Bus-Connection-for-T1-from-
GLIW.567.0.html?&L=1)


With these cookies, we collect anonymized usage data for our website. For
example, we can see which content is interesting for our visitors and which
resolutions are used. We use the information to optimize our website to
provide you with the best possible user experience.


#  Package Summary


		// emergency exit...
		if (Message.ID == 0xff && Message.LEN == 1 && Message.DATA[0] == 0xff)
			break;


[ Windows Configuration Software for PCAN-MicroMod FD Products ](PCAN-
MicroMod-FD-Configuration.513.0.html?&L=1)


[ Windows Software for Displaying LIN Messages ](PLIN-View-
Pro.243.0.html?&L=1)


Kernel peak_usb


Status = CAN_Read(pcan_device, &Message, &ts);


[ **9** forks ](/belovictor/odrive_can_ros_driver/forks)


|

PEAK-cPCI


* Open Source


####  [ PCAN-RP1210 API ](PCAN-RP1210-API.241.0.html?&L=1)


[ API Implementation of the ISO-TP Standard (ISO 15765-2) ](PCAN-ISO-TP-
API.369.0.html?&L=1)


#  Wiki


* **jade:** _Documentation generated on September 03, 2017 at 11:01 AM_ ( [ doc job ](http://build.ros.org/view/Jdoc/job/Jdoc__ros_canopen__ubuntu_trusty_amd64) ).


[ Stand-alone program for displaying plot files from the Plotter Add-in
](Plot-Viewer.552.0.html?&L=1)


[ ![](typo3temp/pics/ee6ee53cb8.jpg) ](PCAN-CCP-API.289.0.html?&L=1)


[ Windows Configuration Software for the MU-Thermocouple1 CAN ](Thermocouple-
Configuration.550.0.html?&L=1)


Statistics


[ 10 Commits  ](/belovictor/odrive_can_ros_driver/commits/main/)


	// be INTRuptible by user
	setup_sig_handler(SIGINT, signal_handler);


Driver


  * [ catkin ](/catkin?distro=kinetic)
  * [ class_loader ](/class_loader?distro=kinetic)


###  Footer navigation


[ ![](typo3temp/pics/6a49b06d64.jpg) ](PLIN-View-Pro.243.0.html?&L=1)


We read every piece of feedback, and take your input very seriously.


[ ![](typo3temp/pics/a8ed8bf0ab.jpg) ](Bit-Rate-Calculation-
Tool.496.0.html?&L=1)


_**[ ros_canopen ](/ros_canopen?distro=kinetic) ** : [ can_msgs
](/can_msgs?distro=kinetic) | [ canopen_402 ](/canopen_402?distro=kinetic) | [
canopen_chain_node ](/canopen_chain_node?distro=kinetic) | [ canopen_master
](/canopen_master?distro=kinetic) | [ canopen_motor_node
](/canopen_motor_node?distro=kinetic) | [ socketcan_bridge
](/socketcan_bridge?distro=kinetic) | socketcan_interface _


  * [ canopen_chain_node ](/canopen_chain_node?distro=kinetic)
  * [ canopen_master ](/canopen_master?distro=kinetic)
  * [ cob_bms_driver ](/cob_bms_driver?distro=kinetic)
  * [ cob_elmo_homing ](/cob_elmo_homing?distro=kinetic)
  * [ cob_generic_can ](/cob_generic_can?distro=kinetic)
  * [ robotiq_3f_gripper_c... ](/robotiq_3f_gripper_control?distro=kinetic)
  * [ ros_canopen ](/ros_canopen?distro=kinetic)
  * [ socketcan_bridge ](/socketcan_bridge?distro=kinetic)


[ Sign in
](/login?return_to=https%3A%2F%2Fgithub.com%2Fbelovictor%2Fodrive_can_ros_driver)


The driver depends on socketcan_bridge package. Please install it prior to
using the driver:


 Contents:

  * [ Installation ](installation.html)
  * [ Configuration ](configuration.html)
  * [ Library API ](api.html)
  * [ Hardware Interfaces ](interfaces.html)
  * [ Virtual Interfaces ](virtual-interfaces.html)
  * [ Plugin Interface ](plugin-interface.html)
  * [ Other CAN bus tools ](other-tools.html)
  * [ Scripts ](scripts.html)
  * [ Developer’s Overview ](development.html)
  * [ History ](history.html)


  * **[ Code API ](http://docs.ros.org/en/melodic/api/socketcan_interface/html) **
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:socketcan_interface/page:1/)
  * [ Changelog ](http://docs.ros.org/en/melodic/changelogs/socketcan_interface/changelog.html)
  * [ Change List ](/ros_canopen/ChangeList)
  * [ Reviews ](/socketcan_interface/Reviews)


TPCANMessage MyMessage = {0}


####  [ PCAN-CCP API ](PCAN-CCP-API.289.0.html?&L=1)


[ Windows® Software for Creating and Editing Symbol Files ](PCAN-Symbol-
Editor-3.250.0.html?&L=1)


Marvin
Top
angux
Posts: 5
Joined: Tue 14. Dec 2021, 14:34
Re: Crash on Read/Write PCANBasic
Post by angux » Thu 16. Dec 2021, 11:49


#  Package Summary


Documented


			if (usleep(1000000))
				break;


[ Windows Software for Direct Access to PCAN-Gateways ](Virtual-PCAN-
Gateway.390.0.html?&L=1)


  * [ Terms ](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
  * [ Privacy ](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
  * [ Security ](/security)
  * [ Status ](https://www.githubstatus.com/)
  * [ Docs ](https://docs.github.com/)
  * [ Contact ](https://support.github.com?tags=dotcom-footer)
  * Manage cookies
  * Do not share my personal information


[ Windows Configuration Software for the MU-Thermocouple1 CAN FD
](Thermocouple-FD-Configuration.551.0.html?&L=1)


    15    with can.Bus() as bus:
    16        # Using specific buses works similar:
    17        # bus = can.Bus(interface='socketcan', channel='vcan0', bitrate=250000)
    18        # bus = can.Bus(interface='pcan', channel='PCAN_USBBUS1', bitrate=250000)
    19        # bus = can.Bus(interface='ixxat', channel=0, bitrate=250000)
    20        # bus = can.Bus(interface='vector', app_name='CANalyzer', channel=0, bitrate=250000)
    21        # ...
    22
    23        msg = can.Message(
    24            arbitration_id=0xC0FFEE, data=[0, 25, 0, 1, 3, 1, 4, 1], is_extended_id=True
    25        )
    26
    27        try:
    28            bus.send(msg)
    29            print(f"Message sent on {bus.channel_info}")
    30        except can.CanError:
    31            print("Message NOT sent")
    32
    33
    34if __name__ == "__main__":
    35    send_one()


[ ![](typo3temp/pics/46b9bee321.jpg) ](CAN-Bus-Connection-for-
Sumac.542.0.html?&L=1)


The listeners are based on  [ FastDelegate
](https://github.com/dreamcat4/FastDelegate) _std::function_ (since melodic)
and use RAII-pointers.


Status = CAN_Read(pcan_device, &Message, &ts);


Toggle Light / Dark / Auto color theme

Toggle table of contents sidebar

_ _


  * Maintainer status: maintained
  * Maintainer: Mathias Lüdtke <mathias.luedtke AT ipa.fraunhofer DOT de>
  * Author: Mathias Lüdtke <mathias.luedtke AT ipa.fraunhofer DOT de>
  * License: LGPLv3
  * Bug / feature tracker: [ https://github.com/ros-industrial/ros_canopen/issues ](https://github.com/ros-industrial/ros_canopen/issues)
  * Source: git [ https://github.com/ros-industrial/ros_canopen.git ](https://github.com/ros-industrial/ros_canopen) (branch: kinetic)


**Package Links**


####  [ PCAN-Symbol Editor 6 ](PCAN-Symbol-Editor-6.416.0.html?&L=1)


###  Netlink status


I appreciate a lot the information.
Thanks again for the help.


    * [ ![Chinese](typo3conf/ext/sr_language_menu/flags/zh.png) Chinese 中文 ](https://peak-system.com.cn)
    * [ ![Korean](typo3conf/ext/sr_language_menu/flags/ko.png) Korean ](http://www.peak-system.kr)


[ CMakeLists.txt ](/belovictor/odrive_can_ros_driver/blob/main/CMakeLists.txt
"CMakeLists.txt")


####  [ PCAN-Developer 4 ](PCAN-Developer-4.461.0.html?&L=1)


[ ](/belovictor/odrive_can_ros_driver/branches) [
](/belovictor/odrive_can_ros_driver/tags)


To see all available qualifiers, see our [ documentation
](https://docs.github.com/search-github/github-code-search/understanding-
github-code-search-syntax) .


[ src ](/belovictor/odrive_can_ros_driver/tree/main/src "src")


		rx_count++;
		printf("  - R ID:%4x LEN:%1x DATA:%02x %02x %02x %02x %02x %02x %02x %02x TS:%010d.%d\n",
				(int) Message.ID, (int) Message.LEN, (int) Message.DATA[0],
				(int) Message.DATA[1], (int) Message.DATA[2],
				(int) Message.DATA[3], (int) Message.DATA[4],
				(int) Message.DATA[5], (int) Message.DATA[6],
				(int) Message.DATA[7], ts.millis, ts.micros);


show more


This website uses strictly necessary cookies to provide functionality for the use of the forum. By browsing this website you agree to the use of cookies. Detailed information on their use can be found in our privacy policy.


|

[ Ixxat (HMS Networks) ](https://www.ixxat.com)


####  [ PCAN-OBD-2 Viewer ](PCAN-OBD-2-Viewer.535.0.html?&L=1)


[ Connection of Pass-Thru Software to PEAK CAN Interfaces & Pass-Thru API
](PCAN-PassThru-API.405.0.html?&L=1)


		if (Status == PCAN_ERROR_QRCVEMPTY) {
			printf("CAN_Read(%xh) Abnormal PCAN_ERROR_QRCVEMPTY status. Wating 1s before looping (^C to stop)...\n", pcan_device);


##  Tested Drivers and Devices


IRQ problems

[ Vendor ](http://www.peak-system.com/fileadmin/media/linux/index.htm)
(NETDEV!)


**Package Links**


Unfortnately we cannot really give much support here as it seems that ROS-environments
have some properties one has to consider when writing applications.


Here I leave you the log files i found. I'm not sure which one of them is the one you're looking for.
 build.symlink.log
(401 Bytes) Downloaded 115 times
 build.make.log
(2.63 KiB) Downloaded 77 times
 build.cmake.log
(2.36 KiB) Downloaded 77 times
Thanks again for the help.
Andres.
Top
angux
Posts: 5
Joined: Tue 14. Dec 2021, 14:34
Re: Crash on Read/Write PCANBasic
Post by angux » Thu 16. Dec 2021, 12:49


* [ Pricing ](/pricing)


##  Languages


I assume you copied our code to your own package? (canopen_driver) in order to use rosrun?


  * **[ Code API ](http://docs.ros.org/indigo/api/socketcan_interface/html) **
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:socketcan_interface/page:1/)
  * [ Changelog ](http://docs.ros.org/en/indigo/changelogs/socketcan_interface/changelog.html)
  * [ Change List ](/ros_canopen/ChangeList)
  * [ Reviews ](/socketcan_interface/Reviews)


[ ![](typo3temp/pics/7fc9997969.jpg) ](PE6-Plotter-Add-in-6.417.0.html?&L=1)


##  [ Packages  0
](/users/belovictor/packages?repo_name=odrive_can_ros_driver)


  * [ catkin ](/catkin?distro=indigo)
  * [ class_loader ](/class_loader?distro=indigo)


Here I leave the code if needed but is the same as the example except for the pcan_device hardcoded and the print for "No err".
CODE: SELECT ALL


####  [ PCAN-MicroMod Configuration ](PCAN-MicroMod-
Configuration.244.0.html?&L=1)


_ _

    * [ CANalyst-II ](interfaces/canalystii.html)
    * [ CANtact CAN Interface ](interfaces/cantact.html)
    * [ ETAS ](interfaces/etas.html)
    * [ Geschwister Schneider and candleLight ](interfaces/gs_usb.html)
    * [ isCAN ](interfaces/iscan.html)
    * [ IXXAT Virtual Communication Interface ](interfaces/ixxat.html)
    * [ Kvaser’s CANLIB ](interfaces/kvaser.html)
    * [ Neousys CAN Interface ](interfaces/neousys.html)
    * [ Intrepid Control Systems neoVI ](interfaces/neovi.html)
    * [ National Instruments NI-CAN ](interfaces/nican.html)
    * [ National Instruments NI-XNET ](interfaces/nixnet.html)
    * [ PCAN Basic API ](interfaces/pcan.html)
    * [ Robotell CAN-USB interface ](interfaces/robotell.html)
    * [ Seeed Studio USB-CAN Analyzer ](interfaces/seeedstudio.html)
    * [ CAN over Serial ](interfaces/serial.html)
    * [ CAN over Serial / SLCAN ](interfaces/slcan.html)
    * [ SocketCAN ](interfaces/socketcan.html)
    * [ socketcand Interface ](interfaces/socketcand.html)
    * [ SYSTEC interface ](interfaces/systec.html)
    * [ USB2CAN Interface ](interfaces/usb2can.html)
    * [ Vector ](interfaces/vector.html)
  * [ Virtual Interfaces ](virtual-interfaces.html)

Toggle navigation of Virtual Interfaces

_ _

    * [ Virtual ](interfaces/virtual.html)
    * [ Multicast IP Interface ](interfaces/udp_multicast.html)
  * [ Plugin Interface ](plugin-interface.html)
  * [ Other CAN bus tools ](other-tools.html)
  * [ Scripts ](scripts.html)
  * [ Developer’s Overview ](development.html)
  * [ History ](history.html)

v: stable


####  Necessary:


[ ![](typo3temp/pics/172928683b.jpg) ](PCAN-Linux.358.0.html?&L=1)


####  [ PEAK-Trace Splitter ](PEAK-Trace-Splitter.555.0.html?&L=1)


[ CMakeLists.txt ](/belovictor/odrive_can_ros_driver/blob/main/CMakeLists.txt
"CMakeLists.txt")


optional requirement: _libelf-dev_

[ PICAN2 (SK Pang Electronics) ](http://skpang.co.uk/catalog/pican2-canbus-
board-for-raspberry-pi-23-p-1475.html)


Device


Board indexAll times are UTC+02:00Delete cookies
This forum was created by PEAK-System Technik GmbH and is a part of www.peak-system.com.
Imprint · Privacy Policy · General Terms of Business


ROS driver for the ODrive motor controller connecting through CAN bus


* Product


[ ros ](/topics/ros "Topic: ros") [ can ](/topics/can "Topic: can") [ odrive
](/topics/odrive "Topic: odrive")


Last commit message


This package contains a generic CAN interface description with helpers for
filtering and driver implementation. Further a socketcan implementation based
on boost::asio is included.


Continuous Integration


[ Windows Software for Displaying CAN and CAN FD Messages ](PCAN-
View.242.0.html?&L=1)


[ ![](typo3temp/pics/3ba83c0f7f.jpg) ](PCAN-Symbol-Editor-6.416.0.html?&L=1)


	FD_ZERO(&fds);
	FD_SET(fd, &fds);


fd_set fds;


[ Visualization and analysis of CAN data in Eclipse with CAN adapters from
PEAK-System ](CAN-Bus-Extension-for-impulse.484.0.html?&L=1)


[ Optional Function Upgrade for the PCAN-Explorer ](PE6-CANdb-Import-Add-
in-6.419.0.html?&L=1)


Language


[ ![](typo3temp/pics/30209e5902.jpg) ](CAN-Bus-Connection-for-
DASYLab.533.0.html?&L=1)


###  Configuration


To use the driver just check it out to your ROS workspace:


####  [ CANopen Controller Library ](CANopen-Controller-
Library.482.0.html?&L=1)


** Used by  (6) **


[ Streaming CAN bus data into MATLAB® or Simulink® with PEAK-System CAN
interfaces ](MathWorks.376.0.html?&L=1)


#ifdef RTAI
	// Initialize LXRT
	RT_TASK *mainr = rt_task_init_schmod(nam2num("EVRD"), 0, 0, 0,
					     SCHED_FIFO, 0xF);
	if (!mainr) {
		printf("pcaneventread(%xh): unable to setup main RT task\n",
			PCAN_DEVICE);
		return -1;
	}
	rt_make_hard_real_time();
#endif
#endif


[ Vendor ](https://www.ixxat.com/support/file-and-documents-
download/drivers/socketcan-driver)


[ 25  stars ](/belovictor/odrive_can_ros_driver/stargazers) [ 9  forks
](/belovictor/odrive_can_ros_driver/forks) [ Branches
](/belovictor/odrive_can_ros_driver/branches) [ Tags
](/belovictor/odrive_can_ros_driver/tags) [ Activity
](/belovictor/odrive_can_ros_driver/activity)


###  Stars


https://github.com/brewb4rt/peak_can_ro ... ntread.cpp


You might want to check if this Github page, as someone converted
pcaneventread to ROS already:


Documented


####  [ PCAN-Trace ](PCAN-Trace.247.0.html?&L=1)


Continuous Integration


_**[ ros_canopen ](/ros_canopen?distro=indigo) ** : [ can_msgs
](/can_msgs?distro=indigo) | [ canopen_402 ](/canopen_402?distro=indigo) | [
canopen_chain_node ](/canopen_chain_node?distro=indigo) | [ canopen_master
](/canopen_master?distro=indigo) | [ canopen_motor_node
](/canopen_motor_node?distro=indigo) | [ socketcan_bridge
](/socketcan_bridge?distro=indigo) | socketcan_interface _


[ ![](typo3temp/pics/f2fad96ff6.jpg) ](PCAN-Explorer-6.415.0.html?&L=1)


####  [ Virtual PCAN-Gateway ](Virtual-PCAN-Gateway.390.0.html?&L=1)


[ Comprehensive Configuration Software for I/O Modules ](PPCAN-
Editor-2.245.0.html?&L=1)


** Used by  (4) **


[ Optional Function Upgrade for the PCAN-Explorer ](PE6-Instruments-Panel-Add-
in-6.418.0.html?&L=1)


##  Footer


[ src ](/belovictor/odrive_can_ros_driver/tree/main/src "src")


		// blocks on read descriptor
		int err = select(fd+1, &fds, NULL, NULL, NULL);
		if (err != 1 || !FD_ISSET(fd, &fds)) {
			printf("select(%xh) failure: %d\n", pcan_device, err);
			break;
		}
		std::cout << "No err" << std::endl;


####  [ MathWorks - Vehicle Network Toolbox™ ](MathWorks.376.0.html?&L=1)


####  [ PPCAN-Editor 2 ](PPCAN-Editor-2.245.0.html?&L=1)


Accept All  Accept Selection


[ Development Package for CANopen® Applications ](CANopen-PC-Developer-
Kit.259.0.html?&L=1)


[ Star  ](/login?return_to=%2Fbelovictor%2Fodrive_can_ros_driver)


##  Use saved searches to filter your results more quickly


[ ](https://github.com "GitHub") © 2024 GitHub, Inc.


[ Windows Software for Updating the Firmware of PEAK-System Hardware Products
](PEAK-Flash.556.0.html?&L=1)


This package contains a generic CAN interface description with helpers for
filtering and driver implementation. Further a socketcan implementation based
on boost::asio is included.


Cancel  Create saved search


[ ![](typo3temp/pics/e0bb2bd7b4.jpg) ](PCAN-UDS-API.370.0.html?&L=1)


  * **[ Code API ](http://docs.ros.org/lunar/api/socketcan_interface/html) **
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:socketcan_interface/page:1/)
  * [ Changelog ](http://docs.ros.org/en/lunar/changelogs/socketcan_interface/changelog.html)
  * [ Change List ](/ros_canopen/ChangeList)
  * [ Reviews ](/socketcan_interface/Reviews)


Last commit date

---|---|---|---

##  Latest commit


[ Receiving and transmitting measurement signals with CAN interfaces from
PEAK-System ](CAN-Bus-Connection-for-DASYLab.533.0.html?&L=1)


#  Page


Powered by phpBB® Forum Software © phpBB Group


[ Library for a Self-Configuring CANopen Controller for PCAN Products
](CANopen-Controller-Library.482.0.html?&L=1)


####  [ PEAK System Information ](PEAK-System-Information.557.0.html?&L=1)


####  Community


[ ![](typo3temp/pics/4d8fa99bfe.jpg) ](Plot-Viewer.552.0.html?&L=1)


[ **7** watching ](/belovictor/odrive_can_ros_driver/watchers)


Bests,
Andres.
Top
7 posts • Page 1 of 1
Return to “PCAN-Basic”


####  [ PE6: J1939 Add-in 6 ](PE6-J1939-Add-in-6.420.0.html?&L=1)


** Used by  (7) **


[ ![](typo3temp/pics/5f9e06371c.jpg) ](PLIN-API.444.0.html?&L=1)


##  History


Not working


  * Maintainer status: maintained
  * Maintainer: Mathias Lüdtke <mathias.luedtke AT ipa.fraunhofer DOT de>
  * Author: Mathias Lüdtke <mathias.luedtke AT ipa.fraunhofer DOT de>
  * License: LGPLv3
  * Bug / feature tracker: [ https://github.com/ros-industrial/ros_canopen/issues ](https://github.com/ros-industrial/ros_canopen/issues)
  * Source: git [ https://github.com/ros-industrial/ros_canopen.git ](https://github.com/ros-industrial/ros_canopen) (branch: melodic)


[ Branches  ](/belovictor/odrive_can_ros_driver/branches) [ Tags
](/belovictor/odrive_can_ros_driver/tags)


##  Overview


Feature-rich tool suite for SocketCAN, install with:


####  PEAK-System


The interface is divided into three parts:


####  [ PEAK-Converter ](PEAK-Converter.554.0.html?&L=1)


  * [ canopen_chain_node ](/canopen_chain_node?distro=melodic)
  * [ canopen_master ](/canopen_master?distro=melodic)
  * [ cob_bms_driver ](/cob_bms_driver?distro=melodic)
  * [ cob_elmo_homing ](/cob_elmo_homing?distro=melodic)
  * [ cob_generic_can ](/cob_generic_can?distro=melodic)
  * [ ros_canopen ](/ros_canopen?distro=melodic)
  * [ socketcan_bridge ](/socketcan_bridge?distro=melodic)


Continuous Integration


#ifndef NO_RT
	mlockall(MCL_CURRENT | MCL_FUTURE);


		// emergency exit...
		if (Message.ID == 0xff && Message.LEN == 1 && Message.DATA[0] == 0xff)
			break;


sudo apt install ros-<ros distribution name>-socketcan-bridge


[ ![](typo3temp/pics/2fdff9afbd.jpg) ](CAN-Bus-Connection-for-T1-from-
GLIW.567.0.html?&L=1)


####  [ LabVIEW CAN/LIN Drivers ](LabVIEW-CAN-LIN-Drivers.255.0.html?&L=1)


Contents


[ ](/belovictor/odrive_can_ros_driver/commits/main/)

###


We are not affiliated/familiar with ROS and do not know if simply running our examples within
ROS will work like this.


#  User


###  Watchers


[ Windows Software for the Presentation and Processing of OBD-2 Data ](PCAN-
OBD-2-Viewer.535.0.html?&L=1)


**Package Links**


roslaunch odrive_can_ros_driver odrive_can_ros.launch


For


#  belovictor/odrive_can_ros_driver


			continue;
		}


[ API for connecting to CAN and CAN FD buses ](PCAN-Basic.239.0.html?&L=1)


[ Optional Function Upgrade for the PCAN-Explorer ](PE6-J1939-Add-
in-6.420.0.html?&L=1)


####  [ CAN FD Frame Analyzer ](CAN-FD-Frame-Analyzer.563.0.html?&L=1)


[ API Implementation of the UDS Standard (ISO 14229-1) ](PCAN-UDS-
API.370.0.html?&L=1)


[ ![Facebook](style/images/icons/Facebook_Icon_white.png)
](https://www.facebook.com/PEAK-System-Technik-GmbH-708749805834855) [
![YouTube](style/images/icons/YouTube_Icon_white.png)
](https://www.youtube.com/user/peaksystemtechnik) [
![RSS](style/images/icons/RSS_Feed_Icon_white.png) ](https://www.peak-
system.com/newsticker/PEAK-System_RSS-Feed.xml) [
![Mail](style/images/icons/Mail_Icon_white.png) ](mailto:info@peak-system.com)


    * [ CI/CD & Automation ](/solutions/ci-cd/)
    * [ DevOps ](/solutions/devops/)
    * [ DevSecOps  ](https://resources.github.com/devops/fundamentals/devsecops/)


		// blocks on read descriptor
		int err = select(fd+1, &fds, NULL, NULL, NULL);
		if (err != 1 || !FD_ISSET(fd, &fds)) {
			printf("select(%xh) failure: %d\n", pcan_device, err);
			break;
		}
		std::cout << "No err" << std::endl;


Kernel peak_pci


        * [ Plot Viewer ](Plot-Viewer.552.0.html?&L=1)
      * [ Third Party Software ](Third-Party-Software.549.0.html?&L=1)
        * [ MathWorks ](MathWorks.376.0.html?&L=1)
        * [ CAN Bus Connection for DASYLab ](CAN-Bus-Connection-for-DASYLab.533.0.html?&L=1)
        * [ CAN Bus Connection for Sumac ](CAN-Bus-Connection-for-Sumac.542.0.html?&L=1)
        * [ CAN Bus Connection for T1 from GLIWA ](CAN-Bus-Connection-for-T1-from-GLIW.567.0.html?&L=1)
        * [ CAN Bus Extension for impulse ](CAN-Bus-Extension-for-impulse.484.0.html?&L=1)
        * [ LabVIEW CAN/LIN Drivers ](LabVIEW-CAN-LIN-Drivers.255.0.html?&L=1)
        * [ QNX driver ](QNX-driver.261.0.html?&L=1)
        * [ MacCAN ](MacCAN.336.0.html?&L=1)
      * [ CANopen ](CANopen.257.0.html?&L=1)
        * [ CANopen Magic ](CANopen-Magic.258.0.html?&L=1)
        * [ CANopen PC Developer Kit ](CANopen-PC-Developer-Kit.259.0.html?&L=1)
        * [ Embedded CANopen Library ](Embedded-CANopen-Library.467.0.html?&L=1)
        * [ CANopen Controller Library ](CANopen-Controller-Library.482.0.html?&L=1)
    * [ Accessories ](Accessories.67.0.html?&L=1)
      * [ Adapters ](Adapters.236.0.html?&L=1)
        * [ ISA-PC/104 Adapter ](ISA-PC-104-Adapter.267.0.html?&L=1)
        * [ PCI-PC/104-Plus Adapter ](PCI-PC-104-Plus-Adapter.268.0.html?&L=1)
        * [ PCI-Express-PCIe/104 Adapter ](PCI-Express-PCIe-104-Adapter.269.0.html?&L=1)
        * [ PCIe-miniPCIe Low-Profile Adapter ](PCIe-miniPCIe-Low-Profile-Adapter.337.0.html?&L=1)
        * [ PCIe-M.2 Low-Profile Adapter ](PCIe-M-2-Low-Profile-Adapter.574.0.html?&L=1)
        * [ PCAN-Term ](PCAN-Term.270.0.html?&L=1)
        * [ PCAN-T-Adapter ](PCAN-T-Adapter.271.0.html?&L=1)
        * [ PCAN-Adapter D-Sub for DR Products ](PCAN-Adapter-D-Sub-for-DR-Products.316.0.html?&L=1)
        * [ PCAN-Adapter D-Sub to Screw Terminals ](PCAN-Adapter-D-Sub-to-Screw-Termina.573.0.html?&L=1)
        * [ PEAK-DevPack Debug Adapter ](PEAK-DevPack-Debug-Adapter.591.0.html?&L=1)
      * [ Cables ](Cables.237.0.html?&L=1)
        * [ PCAN-Cable 1 & 2 ](PCAN-Cable-1-2.272.0.html?&L=1)
        * [ PCAN-Cable 3 ](PCAN-Cable-3.290.0.html?&L=1)
        * [ LIN Connection Cable for PCAN-LIN ](LIN-Connection-Cable-for-PCAN-LIN.291.0.html?&L=1)
        * [ LIN Connection Cable for PC LIN Interfaces ](LIN-Connection-Cable-for-PC-LIN-Int.451.0.html?&L=1)
        * [ PCAN-Cable OBD-2 ](PCAN-Cable-OBD-2.273.0.html?&L=1)
        * [ PCAN-Cable J1939 ](PCAN-Cable-J1939.377.0.html?&L=1)
        * [ PCAN-Cable M12 ](PCAN-Cable-M12.589.0.html?&L=1)
    * [ Discontinued Products ](Discontinued-Products.586.0.html?&L=1)
      * [ PCAN-USB Pro ](PCAN-USB-Pro.200.0.html?&L=1)
      * [ PCAN-USB Hub ](PCAN-USB-Hub.201.0.html?&L=1)
      * [ PCAN-cPCI ](PCAN-cPCI.204.0.html?&L=1)
      * [ PCAN-B10011S ](PCAN-B10011S.218.0.html?&L=1)


####  [ PEAK-Flash ](PEAK-Flash.556.0.html?&L=1)


[ ![Facebook](style/images/icons/Facebook_Icon_white.png)
](https://www.facebook.com/PEAK-System-Technik-GmbH-708749805834855) [
![YouTube](style/images/icons/YouTube_Icon_white.png)
](https://www.youtube.com/user/peaksystemtechnik) [
![RSS_Feed](style/images/icons/RSS_Feed_Icon_white.png) ](https://www.peak-
system.com/newsticker/PEAK-System_RSS-Feed.xml) [
![Mail](style/images/icons/Mail_Icon_white.png) ](mailto:info@peak-system.com)
![to top](style/images/icons/Top_Icon_white.png)


Search…
Quick linksFAQRulesLoginRegister
Board indexSoftware SupportDevelopment PackagesPCAN-Basic
Crash on Read/Write PCANBasic


####  [ PCAN-XCP API ](PCAN-XCP-API.445.0.html?&L=1)


Kernel mcp2515


[ ![](typo3temp/pics/4f62b49632.jpg) ](PCAN-PassThru-API.405.0.html?&L=1)


[ Windows® Software for Creating and Editing Symbol Files ](PCAN-Symbol-
Editor-6.416.0.html?&L=1)


Search or jump to...


####  [ CAN Bus Connection for Sumac ](CAN-Bus-Connection-for-
Sumac.542.0.html?&L=1)


[ ![](typo3temp/pics/1a24920d12.jpg) ](PCAN-Symbol-Editor-3.250.0.html?&L=1)


On the high level this driver has very simple architecture. On one hand it
interacts with CAN bus through 2 topics (one for receiving CAN frames and one
for transmitting them) provided by socketcan_bridge node. On the other hand it
provides several topics for every ODrive axis defined in the configuration for
other nodes like controllers and hardware interfaces to interact with. The
example configuration file provided with the driver shows how to connect to a
6WD chasis based on 3 ODrive controller boards. The axises are addressed
through CAN bus according to their axis IDs configured on ODrive controller
through ` <odrv>.<axis>.config.can.node_id ` attribute


####  ROS 2 Documentation


      * [ Couplers & Converters ](Couplers-Converters.197.0.html?&L=1)
        * [ PCAN-Optoadapter ](PCAN-Optoadapter.215.0.html?&L=1)
        * [ PCAN-Repeater DR ](PCAN-Repeater-DR.216.0.html?&L=1)
        * [ PCAN-LWL ](PCAN-LWL.214.0.html?&L=1)
        * [ PLIN-LWL ](PLIN-LWL.408.0.html?&L=1)
        * [ PCAN-AU5790 ](PCAN-AU5790.217.0.html?&L=1)
        * [ PCAN-TJA1054 ](PCAN-TJA1054.219.0.html?&L=1)
      * [ I/O Modules ](I-O-Modules.318.0.html?&L=1)
        * [ PCAN-MicroMod FD ](PCAN-MicroMod-FD.500.0.html?&L=1)
        * [ PCAN-MicroMod FD Evaluation ](PCAN-MicroMod-FD-Evaluation.501.0.html?&L=1)
        * [ PCAN-MicroMod FD Analog ](PCAN-MicroMod-FD-Analog.508.0.html?&L=1)
        * [ PCAN-MicroMod FD Digital ](PCAN-MicroMod-FD-Digital.509.0.html?&L=1)
        * [ PCAN-MicroMod FD DR CANopen Digital 1 ](PCAN-MicroMod-FD-DR-CANopen-Digital.520.0.html?&L=1)
        * [ PCAN-MicroMod ](PCAN-MicroMod.220.0.html?&L=1)
        * [ PCAN-MicroMod Evaluation ](PCAN-MicroMod-Evaluation.221.0.html?&L=1)
        * [ PCAN-MicroMod Analog ](PCAN-MicroMod-Analog.222.0.html?&L=1)
        * [ PCAN-MicroMod Digital ](PCAN-MicroMod-Digital.223.0.html?&L=1)
        * [ PCAN-MicroMod Mix 1 & 2 ](PCAN-MicroMod-Mix-1-2.224.0.html?&L=1)
        * [ PCAN-MicroMod Mix 3 ](PCAN-MicroMod-Mix-3.226.0.html?&L=1)
        * [ PCAN-MIO ](PCAN-MIO.227.0.html?&L=1)
        * [ MU-Thermocouple1 CAN ](MU-Thermocouple1-CAN.232.0.html?&L=1)
        * [ MU-Thermocouple1 CAN FD ](MU-Thermocouple1-CAN-FD.558.0.html?&L=1)
        * [ PCAN-GPS ](PCAN-GPS.378.0.html?&L=1)
        * [ PCAN-GPS FD ](PCAN-GPS-FD.588.0.html?&L=1)
      * [ Routers & Gateways ](Routers-Gateways.198.0.html?&L=1)
        * [ PCAN-Ethernet Gateway DR ](PCAN-Ethernet-Gateway-DR.330.0.html?&L=1)
        * [ PCAN-Ethernet Gateway FD DR ](PCAN-Ethernet-Gateway-FD-DR.538.0.html?&L=1)
        * [ Virtual PCAN-Gateway ](Virtual-PCAN-Gateway.582.0.html?&L=1)
        * [ PCAN-LIN ](PCAN-LIN.213.0.html?&L=1)
        * [ PCAN-RS-232 ](PCAN-RS-232.287.0.html?&L=1)
        * [ PCAN-Router ](PCAN-Router.228.0.html?&L=1)
        * [ PCAN-Router FD ](PCAN-Router-FD.406.0.html?&L=1)
        * [ PCAN-Router DR ](PCAN-Router-DR.315.0.html?&L=1)
        * [ PCAN-Router Pro ](PCAN-Router-Pro.229.0.html?&L=1)
        * [ PCAN-Router Pro FD ](PCAN-Router-Pro-FD.511.0.html?&L=1)
      * [ Diagnostics & Education ](Diagnostics-Education.319.0.html?&L=1)
        * [ PCAN-Diag 2 ](PCAN-Diag-2.231.0.html?&L=1)
        * [ PCAN-Diag FD ](PCAN-Diag-FD.456.0.html?&L=1)
        * [ PCAN-Diag FD J1939 Add-in ](PCAN-Diag-FD-J1939-Add-in.579.0.html?&L=1)
        * [ PCAN-MiniDiag FD ](PCAN-MiniDiag-FD.490.0.html?&L=1)


Explore


		std::cout << "No err 2" << std::endl;

		if (Status == PCAN_ERROR_QRCVEMPTY) {
			printf("CAN_Read(%xh) Abnormal PCAN_ERROR_QRCVEMPTY status. Wating 1s before looping (^C to stop)...\n", pcan_device);


fd_set fds;


I've debugged the problem a bit but just arrived to a segmentation fault. I've tried my own code and also the examples given in the libraries but can't find the reason of the crash. Any help would be greatly appreciated.
Screenshot from 2021-12-14 14-56-14.png
Screenshot from 2021-12-14 14-56-14.png (33.54 KiB) Viewed 2728 times
In the image above is shown how recognizes the device and I'm able to receive the handshake message.


The SocketCAN driver interface should work with all SocketCAN network
interfaces. The linux mainline kernel already includes some device drivers,
other devices are supported by vendor-provided implementations.


I suspect ROS having an issue with the message object being declared the way it is declared
in our examples, as a test can you change the declaration of the message object accordingly and
see if that does change anything on your end?


TPCANMsg Message = {0};


sudo ip link set can0 up type can bitrate 500000 # adjust bitrate as needed


  * Maintainer status: maintained
  * Maintainer: Mathias Lüdtke <mathias.luedtke AT ipa.fraunhofer DOT de>
  * Author: Mathias Lüdtke <mathias.luedtke AT ipa.fraunhofer DOT de>
  * License: LGPLv3
  * Bug / feature tracker: [ https://github.com/ros-industrial/ros_canopen/issues ](https://github.com/ros-industrial/ros_canopen/issues)
  * Source: git [ https://github.com/ros-industrial/ros_canopen.git ](https://github.com/ros-industrial/ros_canopen) (branch: jade)


[ ![](typo3temp/pics/6c55352e9b.jpg) ](PCAN-Basic.239.0.html?&L=1)


[ config ](/belovictor/odrive_can_ros_driver/tree/main/config "config")


	// forever loop
	while (1) {


[ Documentation Status ](javascript:toggleDocStatus\(\))


##  About


Generic CAN interface description with helpers for filtering and driver
implementation. Further a socketcan implementation based on boost::asio is
included.


By Solution


#  Saved searches


[ ![](typo3temp/pics/207f524486.jpg) ](PPCAN-Editor-2.245.0.html?&L=1)


#  odrive_can_ros_drive


You can’t perform that action at this time.


#ifdef RTAI
	// Initialize LXRT
	RT_TASK *mainr = rt_task_init_schmod(nam2num("EVRD"), 0, 0, 0,
					     SCHED_FIFO, 0xF);
	if (!mainr) {
		printf("pcaneventread(%xh): unable to setup main RT task\n",
			PCAN_DEVICE);
		return -1;
	}
	rt_make_hard_real_time();
#endif
#endif


[ ![](typo3temp/pics/1b73ff9a74.jpg) ](Embedded-CANopen-
Library.467.0.html?&L=1)


[ ![](typo3temp/pics/76676042ee.jpg) ](PCAN-FMS-Simulator-2.246.0.html?&L=1)