Skip to content

VESC Interface #13

@HaoruXue

Description

@HaoruXue

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

  • The node shall subscribe to a tai_interface/msg/VehicleControl topic called vehicle_cmd.

Publishers

  • The node shall publish the following 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:

  • 'servo_neutral: the neutral steerign value might not be as simple as the average of servo_minandservo_max`. Some steering mechanism would have a slight different neutral value.
  • wheel_radius: useful for converting the speed in vehicle_cmd (m/s) to RPM
  • rpw_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,

  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

  • Implement the node with basic message conversions
  • Implement all parameters and parameter callback
  • Test on a vehicle with joy_node and joy_tai_interface to teleop.
  • Convert this issue into a design document and put in the package (vesc_tai_interface/design/README.md)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions