ROS with VESC motor controller
ROS Kinetic and VESC, a simple recipe on Ubuntu 16.04
- Install ROS kinetic full desktop
http://wiki.ros.org/kinetic/Installation/Ubuntu
- Install ROS serial
apt-get install ros-kinetic-serial
- Create catkin_ws
mkdir catkin_ws
cd catkin_ws
mkdir src
cd src
catkin_init_workspace
- Install VESC driver packages
git clone from:
https://github.com/mrsd16teamd/loco_car
To compile, need
loco_car/utilities/ackermann_msgs
loco_car/utilities/vesc
Compile
. /opt/ros/kinetic/setup.sh
cd ~/catkin_ws
catkin_make
Each terminal needs setup, unless append to .bashrc
. /opt/ros/kinetic/setup.sh
. ~/catkin_ws/devel/setup.sh
Terminal 1. Run roscore
roscore
Using VESC STM32F407 as serial port, mapped as /dev/ttyACM0
$ lsusb
..
Bus 001 Device 010: ID 0483:5740 STMicroelectronics STM32F407
$ cat /sys/class/tty/ttyACM0/device/uevent
DEVTYPE=usb_interface
DRIVER=cdc_acm
PRODUCT=483/5740/200
TYPE=2/0/0
INTERFACE=2/2/1
MODALIAS=usb:v0483p5740d0200dc02dsc00dp00ic02isc02ip01in00
Terminal 2. Run VESC node, wants port as parameter
rosrun vesc_driver vesc_driver_node _port:=/dev/ttyACM0
Output:
[ INFO] [1523385642.355806199]: Connected to VESC with firmware version 2.18
Terminal 3. Subscribe telemetry
rostopic echo /sensors/core
Sample output:
header:
seq: 3292
stamp:
secs: 1523385708
nsecs: 216151628
frame_id: ''
state:
voltage_input: 13.3
temperature_pcb: 28.1
current_motor: 0.0
current_input: 0.0
speed: 0.0
duty_cycle: 0.001
charge_drawn: 3.0
charge_regen: 0.0
energy_drawn: 48.0
energy_regen: 0.0
displacement: 11472.0
distance_traveled: 11472.0
fault_code: 0
Terminal 4. Manually publish messages to 2000rpm speed topic (at 20hz)
rostopic pub -r 20 /commands/motor/speed -- std_msgs/Float64 2000
Original loco_car article (highly appreciated),
https://github.com/mrsd16teamd/loco_car/wiki/VESC
Kommentit
Lähetä kommentti