0
$\begingroup$

TLDR; looking for algorithms to control a motor. I have a near-random torque, a battery current that can destroy my motor driver, and I aim for a stable output speed regardless of torque. My inputs are current as reported by the motor driver, and a rotary encoder.

Google led me to PID (proportional, integral, derivative) motor control. That doesn't stop drawing too much current when the motor stalls/starts. Looking at internet examples, PID also seems more suited for predictable or more tunable loads. I'm trying to avoid reinvent the wheel. Is there some algorithm/library that handles this? Should this be a hardware/electrical safety?

Background

I'm building a mechanical walker robot for an art show along with two master students. They're a bit behind and I'm helping out with the code (approved by their profs). I can code but I lack insight in the control algorithms that I can implement.

The walker has 6 segments. Each segment has 2 legs. The legs are moved with a linkage system, all tied together with a central drive to keep all legs in sync.

I have:

  • arduino nano
  • 500W 24V brushed DC motor
  • BTS7960 43A motor controller dual H-bridge
    • L- and R- current sense readout of the controller
  • Rotary encoder
  • RC transceiver with a pressure sensitive trigger
  • Li-Ion battery packs that can supply 60A
  • A 6 meter (20ft) 12-legged walker with variable torque between -3 and 10Nm
    • As the legs go round, there is a function (from simulation and measurements) to get the expected torque for a certain leg position on a flat surface. As soon as we hit a bump in the road, the balance shifts and we have no idea. I guess I should consider torque to be random.
  • Walking speed that is +-1000rpm (30:1 gear reduction in drive shaft to legs)

My goals:

  • more or less constant speed, regardless of torque
  • don't burn the controller/motor
    • current protection for startup/stall ?

Current status:

  • motor spins depending on RC trigger (no load)
  • rotary encoder signal is coming in
  • current sense is still troublesome, but I found a video. Hope to have that working soon
  • copy-pasted implementation of PID, but without load this doesn't do much

Any advice is appreciated, especially if I'm doing something stupid. It's a broad topic to quickly wrap my head around.

$\endgroup$
1
  • $\begingroup$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. $\endgroup$
    – Community Bot
    Commented Jun 8 at 14:33

1 Answer 1

0
$\begingroup$

The walker has 6 segments. Each segment has 2 legs. The legs are moved with a linkage system, all tied together with a central drive to keep all legs in sync.

...get the expected torque for a certain leg position on a flat surface. As soon as we hit a bump in the road, the balance shifts and we have no idea...

This means that, in a walk cycle, a leg in contact with the (bumpy) ground will transmit back to the motor, the reaction force from the ground. Since the legs are all linked, the power output by the motor is wasted opposing the reaction forces. The reaction forces will be very high if the road surface and the leg mechanisms are rigid (high stiffness / high modulus of elasticity).

Option 1

Introduce compliance into the system. Give the legs a soft padding or a spring so that the legs in contact with the ground don't generate high reaction forces which the motor need to oppose. Another option is to make the ground softer; e.g. a layer of sand or gravel

The smaller, and more even the reaction forces, the easier it will be for your motor controller to maintain constant speed.

Option 2

Independent drives for legs with force measuring sensors on each foot. When the legs touch the ground, sensors will sense reaction force from the ground, stop giving motion command to those legs. Those legs should switch over to a force control PID instead of a position control PID.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.