No version for distro humble. Known supported distros are highlighted in the buttons above.
No version for distro jazzy. Known supported distros are highlighted in the buttons above.
No version for distro rolling. Known supported distros are highlighted in the buttons above.
Repository Summary
Description | generate ROS/ROS2 node based on DBC files |
Checkout URI | https://github.com/pixmoving-moveit/vehicle_ros_driver_generator.git |
VCS Type | git |
VCS Version | main |
Last Updated | 2023-05-10 |
Dev Status | UNKNOWN |
CI status | No Continuous Integration |
Released | UNRELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
No packages found.
README
Vehicle ROS Driver Generator
Overview
This tool was inspired by the Gen Vehicle Protocol Tool in Apollo. We modified this tool for ROS/ROS2 driver generation according to the DBC file of vehicles.
Tool Framework
-
gen.py
: main code, uses other libraries, createpix_{car_type}_driver
andpix_{car_type}_driver_msgs
-
extract_dbc_meta.py
: decodes DBC file then creates yml file for easy use of canbus protocol -
gen_msg_file.py
: generates msg ROS package, according to the yml file of canbus protocol -
gen_protocols.py
: generates c++ header files and source files for canbus protocol, according to the yml file of cnabus protocol -
gen_ros_node.py
: generates the ROS nodes ofcontrol_command
andreport_parser
-
gen_config_file.py
: generatesCMakeLists.txt
andpackages.xml
files
HOW TO USE
Notice: The names of CAN frames and the names of variables in CAN frames should be camel case like below.
BO_ 1330 SteerStaFb: 8 VCU
SG_ ChassisSteerEnSta : 0|1@1+ (1,0) [0|1] "" ACU
SG_ ChassisSteerSlopover : 1|1@1+ (1,0) [0|1] "" ACU
SG_ ChassisSteerWorkMode : 2|2@1+ (1,0) [0|3] "" ACU
SG_ ChassisSteerModeFb : 4|4@1+ (1,0) [0|15] "" VCU
SG_ ChassisSteerAngleFb : 8|16@1- (1,0) [-500|500] "deg" ACU
SG_ ChassisSteerAngleRearFb : 24|16@1- (1,0) [-500|500] "deg" ACU
SG_ ChassisSteerAngleSpeedFb : 40|8@1+ (2,0) [0|500] "deg/s" ACU
1. copy the DBC file of your vehicle to config
folder, for example pixmocing.dbc
, for example pix_moving_conf.yml
dbc_file: pixmoving.dbc # DBC file
protocol_conf: pixmoving.yml # generated canbus protocol file
car_type: hooke # name of vehicle, if it is hooke, the generated packages should be 'pix_hooke_driver` and `pix_hooke_driver_msgs`
sender_list: [DriveCtrl, BrakeCtrl, SteerCtrl, VehicleCtrl, WheelCtrl] # name of CAN Frames that be sent to vehicle
sender: ACU # name of sender
black_list: []
output_dir: output # output directory
config_dir: config/ # config file directory
3. run gen.py
run code
python3 gen.py config/pixmoving_conf.yml
if success, you will see the output below
Extract car_type:HOOKE's protocol meta info to file: config/pixmoving.yml
Total parsed protocols: 15
Control protocols: 5
Report protocols: 10
Generating protocols
Generating canID node cpp
9
Generating canID Config file
['drive_ctrl', 'brake_ctrl', 'steer_ctrl', 'vehicle_ctrl', 'wheel_ctrl']
4. Auto-generated code
the structure of auto-generated code are shown below.
├── pix_hooke_driver
│ ├── CMakeLists.txt
│ ├── include
│ │ └── pix_hooke_driver
│ │ ├── Byte.hpp
│ │ ├── brake_ctrl.hpp
│ │ ├── brake_sta_fb.hpp
│ │ ├── chassis_wheel_angle_fb.hpp
│ │ ├── chassis_wheel_rpm_fb.hpp
│ │ ├── chassis_wheel_tire_press_fb.hpp
│ │ ├── control_command.hpp
│ │ ├── drive_ctrl.hpp
│ │ ├── drive_sta_fb.hpp
│ │ ├── power_sta_fb.hpp
│ │ ├── report_parser.hpp
│ │ ├── steer_ctrl.hpp
│ │ ├── steer_sta_fb.hpp
│ │ ├── vehicle_ctrl.hpp
│ │ ├── vehicle_flt_sta.hpp
│ │ ├── vehicle_sta_fb.hpp
│ │ ├── vehicle_work_sta_fb.hpp
│ │ └── wheel_ctrl.hpp
│ ├── package.xml
│ └── src
│ ├── Byte.cc
│ ├── brake_ctrl.cc
│ ├── brake_sta_fb.cc
│ ├── chassis_wheel_angle_fb.cc
│ ├── chassis_wheel_rpm_fb.cc
│ ├── chassis_wheel_tire_press_fb.cc
│ ├── control_command.cpp
│ ├── control_command_node.cpp
│ ├── drive_ctrl.cc
│ ├── drive_sta_fb.cc
│ ├── power_sta_fb.cc
│ ├── report_parser.cpp
│ ├── report_parser_node.cpp
│ ├── steer_ctrl.cc
│ ├── steer_sta_fb.cc
│ ├── vehicle_ctrl.cc
│ ├── vehicle_flt_sta.cc
│ ├── vehicle_sta_fb.cc
│ ├── vehicle_work_sta_fb.cc
│ └── wheel_ctrl.cc
└── pix_hooke_driver_msgs
├── CMakeLists.txt
├── msg
│ ├── BrakeCtrl.msg
│ ├── BrakeStaFb.msg
│ ├── ChassisWheelAngleFb.msg
│ ├── ChassisWheelRpmFb.msg
│ ├── ChassisWheelTirePressFb.msg
│ ├── DriveCtrl.msg
│ ├── DriveStaFb.msg
│ ├── PowerStaFb.msg
│ ├── SteerCtrl.msg
│ ├── SteerStaFb.msg
│ ├── VehicleCtrl.msg
│ ├── VehicleFltSta.msg
│ ├── VehicleStaFb.msg
│ ├── VehicleWorkStaFb.msg
│ └── WheelCtrl.msg
└── package.xml
7 directories, 57 files
CONTRIBUTING
No CONTRIBUTING.md found.
No version for distro noetic. Known supported distros are highlighted in the buttons above.
No version for distro ardent. Known supported distros are highlighted in the buttons above.
No version for distro bouncy. Known supported distros are highlighted in the buttons above.
No version for distro crystal. Known supported distros are highlighted in the buttons above.
No version for distro eloquent. Known supported distros are highlighted in the buttons above.
No version for distro dashing. Known supported distros are highlighted in the buttons above.
No version for distro galactic. Known supported distros are highlighted in the buttons above.
No version for distro foxy. Known supported distros are highlighted in the buttons above.
No version for distro iron. Known supported distros are highlighted in the buttons above.
No version for distro lunar. Known supported distros are highlighted in the buttons above.
No version for distro jade. Known supported distros are highlighted in the buttons above.
No version for distro indigo. Known supported distros are highlighted in the buttons above.
No version for distro hydro. Known supported distros are highlighted in the buttons above.
No version for distro kinetic. Known supported distros are highlighted in the buttons above.
No version for distro melodic. Known supported distros are highlighted in the buttons above.