Open HaoruXue opened 2 years ago
VESC conventions: brake_max, brake_min: reverse currents in mA needed to stop the motor (start at 5000mA throttle) current_max, current_min: movement no position_min/max (needs to be removed) servo_max, servo_min: default (0, 1)
-1 0 1 servo_min neutral servo_max
Description
In Triton AI Racer, we use
tai_interface/msg/VehicleControl
to control the vehilce actuators (steering, throttle, braking). To control a VESC, however, to be compatable withvesc_driver_node
, we need to convert and publishstd_msgs/msg/Float64
for individual actuators. A package calledvesc_tai_interface
is needed which contains avesc_tai_interface_node
that does the conversion.Desired Behavior
Subscribers
tai_interface/msg/VehicleControl
topic calledvehicle_cmd
.Publishers
std_msgs/msg/Float64
topics:commands/motor/current
commands/motor/brake
commands/motor/speed
commands/servo/position
Parameters
The node shall share most parameters with
vesc_driver_node
for the actuator mappings, namely,brake_max
brake_min
current_max
current_min
position_max
position_min
servo_max
servo_min
speed_max
speed_min
Read the source code to figure out their ranges and meanings.
In addition, the following three parameters are needed:
: the neutral steerign value might not be as simple as the average of
servo_minand
servo_max`. Some steering mechanism would have a slight different neutral value.wheel_radius
: useful for converting the speed invehicle_cmd
(m/s) to RPMrpw_to_electrical_rpm_factor
: Here is why this parameter exists.The node should also support dynamic parameter configuration with parameter-change callback.
Logics
On receiving a
vehicle_cmd
,longitudinal_control_type
isLON_CTL_THROTTLE_BRAKE
, map and publish the throttle (current) and brake valueslongitudinal_control_type
isLON_CTL_SPEED
, map and publish the speed value (remember to convert from m/s to electrical RPM)lateral_control_type
is LAT_CTL_OPENLOOP, usesteering_openloop
to map and publish steeringservo_min
toservo_neutral
;servo_neutral
toservo_max
, each corresponding to (-1, 0) and (0, 1) invehicle_cmd.steering_openloop
.lateral_control_type
is LAT_CTL_CLOSELOOP, throw an error. The VESC does not support closeloop steering at the moment.Definition of Done
joy_node
andjoy_tai_interface
to teleop.vesc_tai_interface/design/README.md
)