Triton-AI / Triton-AI-Racer-ROS2

Core repo for the unified Triton AI Racer platform for autonomous race vehicles in ROS2
Apache License 2.0
4 stars 5 forks source link

VESC Interface #13

Open HaoruXue opened 2 years ago

HaoruXue commented 2 years ago

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 with vesc_driver_node, we need to convert and publish std_msgs/msg/Float64 for individual actuators. A package called vesc_tai_interface is needed which contains a vesc_tai_interface_node that does the conversion.

Desired Behavior

Subscribers

Publishers

Parameters

The node shall share most parameters with vesc_driver_node for the actuator mappings, namely,

Read the source code to figure out their ranges and meanings.

In addition, the following three parameters are needed:

The node should also support dynamic parameter configuration with parameter-change callback.

Logics

On receiving a vehicle_cmd,

  1. If longitudinal_control_type is LON_CTL_THROTTLE_BRAKE, map and publish the throttle (current) and brake values
  2. If longitudinal_control_type is LON_CTL_SPEED, map and publish the speed value (remember to convert from m/s to electrical RPM)
  3. If lateral_control_type is LAT_CTL_OPENLOOP, use steering_openloop to map and publish steering
    1. The mapping has two segments: servo_min to servo_neutral; servo_neutral to servo_max, each corresponding to (-1, 0) and (0, 1) in vehicle_cmd.steering_openloop.
  4. If lateral_control_type is LAT_CTL_CLOSELOOP, throw an error. The VESC does not support closeloop steering at the moment.

Definition of Done

GSam789 commented 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