ros-industrial / ros_canopen

CANopen driver framework for ROS (http://wiki.ros.org/ros_canopen)
GNU Lesser General Public License v3.0
328 stars 267 forks source link

CAN IDs of 0x18FFFFFF not showing up in candump #478

Open a-stana opened 1 year ago

a-stana commented 1 year ago

Sorry if this is the wrong place to ask this question but I've been searching the web and haven't found any answers. Basically, I have a C++ code that generates CAN messages for my application. The correct ID to publish would be 0x18FFFFFF. However, generating this ID in my code does not produce any output in the candump. I need to generate the ID as 0x98FFFFFFFF to see the message displayed correctly in the candump.

As the devices I am communicating with use the j1939 protocol, I need to send the messages (0x18FFFFFFFF) generating the priority value of 6 in bit 28-26, hence 0x18. I don't know if the protocol is responsible for the miscommunication, but I assume it's not because the candump is not bound to protocols directly, it just puts out raw messages, right?

I am using a PEAK_USB as an interface coupled with ROS noetic running on Ubuntu 20.04 LTS and I guess I am relying on socket_can at system level, msgs::can in ROS and this C++ code snippet: ` //can message can_msg.id = 0x98FFFFFFFFFF // 0x98FFFFFFFFFFFF instead of 0x18FFFFFFFFFFFFFF to get the correct output in the dump can_msg.length = 8; can_msg.flags = 0x00; can_msg.cob = 0x00; //data can_msg.data[0] = 0x00; can_msg.data[1] = 0x01; can_msg.data[2] = 0x02; can_msg.data[3] = 0x00; can_msg.data[4] = 0x00; can_msg.data[5] = 0x00; can_msg.data[6] = 0x00; can_msg.data[7] = 0x00;

can_tx_pub.publish(can_msg); // inline void ros::Publisher::publish(const msgs::can &message) const ` I was given this project by a colleague at university, I'm relatively new to ROS and C++ and don't know where to look for conversion errors or problems or basically what to do to find out what's happening. I would really appreciate any help or advice.