Warning to everyone working on “auto balance”

This feature is ** deceptively simple.** I know exactly what everyone thought when they saw this challenge. I have even seen it implemented in some Ri3D code. So here is what I know your thinking about.

  • measure gyro angle
  • use PID to move forwards and backwards depending on if it’s tilted
  • slow down robot until it works

But this challenge is way more complicated than that. You need more than a PID controller here just because of the number of variables.

With traditional position control PID, you really only care about robot position and robot velocity (controlled by p and d terms). This challenge requires not only control over robot position and velocity, but control over the charging station angle and angular velocity.

Unless your team has a lot of experience with control theory, it might just be worth letting the human do the balancing. EDIT: It appears that it is possible to get it done in a simple way

We are planning to use two PID controllers, one that takes the angle of the switch and generates a target position, and a second that takes the target position and drives the robot to that spot.

If you guys have any other ideas, it would be great to share them, as this is one of the trickiest control problems FRC has seen recently.

26 Likes

100%

Intersting solution… how would you make sure that controller 2 is aware of what controller 1 wants to do?

Would 2 dimensional PIDs be a possbility to solve this problem, taking into account the angle and current velocity?

3 Likes

I believe that balancing should be a very slight thing, like aim assist, for the drivers. It’s easy to get a human to understand how to tell when it needs balancing, but the robot has no idea what’s going on around it other than in this case a gyro. It’s a very complicated problem that has many solutions, though most will do just fine.

EDIT: I misunderstood what a 2 dimensional PID controller was, he is in fact correct.

3 Likes

Given the presence of a physical deadzone, I feel like it’d be effective and incredibly simple to use a sort of bang-bang control.

Like this:

if(gyro_tilted){
  if(gyro_moving){
    drive_direction = stop;
  } else {
    drive_direction = up_ramp;
  }
} else {
  drive_direction = stop;
}

I might be greatly oversimplifying, but with a small amount of parameter tuning and possibly an odometric adjustment once tilting, I imagine this would work just fine. Whereas the nonlinearities in tilting may come out to bite PID users.

11 Likes

There are two dimensions: forward/backward, and tilt. A sort of control system that references both of these values will be much more effective than a 1D system.

The issue with this is, imagine the switch is held down, your robot will fly off the edge. This is because simple first order controllers don’t contain enough information to control this ideally.

this is going to Bing Bang you all the way to a hospital. There needs to be a lot more control even for a mock command

5 Likes

Yes but ideally in auto, you would be the only one engaging. In teleop the driver would be able to override the behavior.

2 Likes

Not to downplay the challenge of building an effective system too much (getting anything to work reliably in the real world is hard in robotics!), but some teams were doing this successfully all the way back in 2001 (and again in 2012).

As far as I know, none of those teams did anything particularly complex in terms of controls. The key thing to remember is that the bridge has quite a bit of hysteresis due to the double hinge, so this isn’t really an inverted pendulum type problem.

(Now, two or three robots who are trying to auto balance simultaneously would be a real party…)

54 Likes

when they are all balanced they just start shaking because most teams probably won’t have a min angle deadzone.

But really. I don’t think you can just have 3 robots balance automatically, the smallest delay can cause a loop in all the bots trying to move.

2 Likes

actually the system of having 2 PID loops will account for other bots on the balance.

3 Likes

IIRC, some teams suspended a weight on arm off a pot to make a crude “gyro” and then closed the loop on that… so I am optimistic with current tech :wink:

14 Likes

With a deadzone and distance limits I can see this working quite well with a limited maximum speed.

2 Likes

This 2-dof PID control approach has been shown to work on the two-wheeled inverted pendulum problem. Fairly simple too.

3 Likes

I am like a very Math + CS type guy so i thought it was best to model this like an inverted pendulum with a dead zone.

It will certainly be interesting to see what teams come up with, but i really hope that more teams share the math the end up using. Not only is it interesting to read, but it makes FIRST more equitable, especially for high schools that don’t offer higher level math courses.

1 Like

I think a good solution is to have a gradient map for how sensitive it is to angles.

2 Likes

I could be simply misunderstanding the idea of a 2d pid controller as I am traveling right now and couldn’t read the link.

edit: the link you sent is exactly what i was describing

A thought:
Detect when the robot angle reaches the 11-ish degrees (IE its fully on the charging station).
That will give you a well known position.
Drive forward a specific distance; ideally the target is the center of the dead zone.
Wait for a maximum of ?? seconds for an angle change.
If the angle doesn’t change drive forward to almost the far end of the dead zone
Once the angle starts changing wait for it to stop changing
UNLESS the angle starts to go negative; response immediately by backing up half a dead zone/

I think the hysteresis of the system is really going to complicate this!

Super cool would be to have a LIDAR spinner scanning across the charging station where it could see the floor on both sides (horizontal axis spin). With that you would know where you were on the platform without the issue of slipping wheels.

The impact of the other robots (mass and location) will change the dynamics a LOT and also move the dead zone. Hmmmm

1 Like

If you really want an inverted pendulum type problem, try to get the bridge to balance at an angle of 2.4 degrees from the floor plane and hold there for 3 seconds after the match end. Anything within 2.5 degrees counts as LEVEL, so you could get all the points, and have a fun programming challenge, and make things exciting for spectators.

9 Likes