Skip to main content

Crate mecha10_nodes_motor

Crate mecha10_nodes_motor 

Source
Expand description

Motor Node

This node manages motor control with configurable controller backends. It provides velocity control through the standard /motor/cmd_vel topic and publishes odometry data.

§Controller Selection

The node supports multiple motor controllers, selected via configuration:

  • mock: Simulated motors for testing/development (no hardware required)
  • l298n: L298N dual H-bridge driver for DC motors

§Topics

  • Subscribes: /motor/cmd_vel (Twist) - Velocity commands
  • Publishes: /odom (Odometry) - Odometry data
  • Publishes: /motor/status (MotorStatus) - Motor status

§Configuration

{
  "controller": {
    "type": "mock",  // or "l298n"
    "wheel_base": 0.3,
    "max_velocity": 1.0
  },
  "odom_rate_hz": 50.0,
  "max_linear_vel": 0.5,
  "max_angular_vel": 1.0
}

See config.rs for full configuration options.

Modules§

topics
Motor node topics

Structs§

L298nControllerConfig
L298N controller configuration
L298nMotorPins
Pin configuration for a single L298N motor
MockControllerConfig
Mock controller configuration
MotorConfig
Motor node configuration
MotorNode
Motor node

Enums§

ControllerConfig
Motor controller configuration - tagged union

Traits§

DynMotorController
Trait alias for dynamic dispatch of motor controllers

Functions§

create_motor_controller
Create a motor controller based on configuration
run
Run the motor node with V2 configuration system

Type Aliases§

BoxedMotorController
Boxed motor controller trait object