Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

previously received data remains #17

Open
a-higuchi opened this issue Sep 1, 2022 · 1 comment
Open

previously received data remains #17

a-higuchi opened this issue Sep 1, 2022 · 1 comment

Comments

@a-higuchi
Copy link
Contributor

Description

If the DLC(Data Length Code) is less than 8, the previously received data remains in the "data" field of the topic sent by ros2_socketcan.

When supporting multiple types of HW with the same CAN-ID but different DLCs, unintended behavior may occur if garbage is included in the reception result of can_receiver.

I checked with the following steps.

Preparation

  • Install can-utils
sudo apt install can-utils
  • Enable vcan
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
  • Invoke ros2_socketcan
ros2 launch ros2_socketcan socket_can_bridge.launch.xml interface:=vcan0
  • Invoke candump
candump vcan0
  • Topic monitoring
ros2 topic echo /from_can_bus

Procedure

Send the following CAN data with cansend.

cansend vcan0 200#1122334455667788
cansend vcan0 123#aa

Output

  • candump output
  vcan0  200   [8]  11 22 33 44 55 66 77 88
  vcan0  123   [1]  AA
  • Topic output
header:
  stamp:
    sec: 1661924425
    nanosec: 956480272
  frame_id: can
id: 512
is_rtr: false
is_extended: false
is_error: false
dlc: 8
data:
- 17
- 34
- 51
- 68
- 85
- 102
- 119
- 136
---
header:
  stamp:
    sec: 1661924437
    nanosec: 538097128
  frame_id: can
id: 291
is_rtr: false
is_extended: false
is_error: false
dlc: 1
data:
- 170
- 34
- 51
- 68
- 85
- 102
- 119
- 136
---
@JWhitleyWork
Copy link
Collaborator

Closed by #18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants