Skip to content

Lower level controller and ESC/Motor subsystem #7

@grmarcil

Description

@grmarcil

I'm interested if others have thoughts on this or a better understanding than I do. Please comment if so. In particular I think @jgonzal13 may have some work in progress on one or both of these topics.

Lower level controller
I've talked to Jon about his plans for standardizing the control input interface. I think we discussed converting the ROS ECU message to be (acceleration, steering angle) rather than (motor_pwm, steering_pwm), then doing the (accel, angle) -> (pwm, pwm) translation on the arduino before writing those commands to the ESC and servo. I've thought about this more and IMO it makes better sense to run this translation code (the "lower level controller") on the odroid in python. I think reserving the Arduino as a simple-as-possible input/output node is a good architecture choice. Plus python is more user friendly and could support tuning steering bias for individual vehicles (although I guess we could do that with some I/O in C++ on the Arduino too). Thoughts?

image

ESC/Motor Subsystem
This is the main question on my mind, which boils down to "how do we transform desired acceleration to ESC pwm commands?" My understanding of the ESC is that "speed controller" is a misnomer really. In my understanding, the ESC controls the timing of the 3-phase AC power that goes to the brushless motor, and varies the RMS voltage supplied to the motor according to the throttle PWM. Eg, a pwm of 135 would correspond to 50% throttle, so assuming no gain applied, the RMS voltage supplied to the motor would be 4.2V, or half the battery voltage.

This theory needs verification, but it's the most plausible understanding I've come to after reading up on this for a while (lots of RC hobbyist explanations of varying quality to sift through). Assuming this is true, we could rely on a constant relationship between throttle PWM and motor voltage, then the relationship between motor speed and torque is linear Torque-Speed Curve for a constant voltage. We could model this by measuring the no-load speed and stall torque at a number of PWM values. I'm not sure how easy it is to parametrize the torque-speed curve by voltage, but hopefully it follows a reasonable pattern.

The diagram I sketched should include a connection of the state estimate of speed sent with the lower level controller. We could use a longitudinal vehicle model with to convert desired acceleration to desired torque, accounting for drivetrain ratios, aero drag, and frictional losses. We could work backwards from the wheel speed through the drivetrain ratios to get motor rpm, then look up the pwm value that has a torque-speed curve matching the current motor rpm to the desired torque.

Rough outline of steps toward implementing this

  1. Verify ESC assumptions (predictable relationship between pwm and rms voltage)
  2. Model the torque-speed curve at a range of voltages (we may be able to look this up given the motor type)
  3. Implement and verify controller

I'm very interested in feedback on this idea, please let me know if there are gaps in my logic or if this is more complex than it needs to be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions