linux-can / can-utils

Linux-CAN / SocketCAN user space applications
2.44k stars 714 forks source link

Generate simple CAN messages #219

Closed gsus24 closed 4 years ago

gsus24 commented 4 years ago

Hello its not an issue, its a starting point. Hope its ok asking here. I playing around with CARLA Simulator for autonomous driving research https://github.com/carla-simulator/carla Its possible to read values for speed, acceleration, throttle, brakepedal, ... My hope is to put this values in CAN messages.

Any suggestions on doing that are welcome. Thanks and best regards

marckleinebudde commented 4 years ago

Hey @gsus24,

what's your use case? Control your real car with the data from the simulation?

There are several project out there that do the de-coding of the CAN buses of real vehicles. Have a look how to map the data values from the simulation to the raw CAN frames. You probably want to re-use some kind of mapping file/database/etc from other projects.

Then look at https://github.com/linux-can/can-utils/blob/master/cansend.c how to open a socket, assemble a CAN frame and send it out. I think there is a python binding for CAN.

gsus24 commented 4 years ago

Hi @marckleinebudde i want to get telemetry data for simulation like throttle and brakepedalposition, speed, gear, steering angle... out of CARLA Simulator via CAN-bus and receive and the messages in my program together with Images and drive the car autonomously. Thanks for the tip with cansend. I used it as workaround with systemcommand for validating the receive. I take a look for pyhton implementation and find this https://github.com/eerimoq/cantools