Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Robot Balboa cant stand up

Hi, I introduce de example code of balancing in my balboa and only it do this. How can i fix it?

Thank you very much

Hello.

To get your Balboa to start balancing I suggest physically picking up your Balboa so that it is entirely off the ground to stand it upright then setting its wheels on the ground so it is already in a close to balanced position. When you first do this can you confirm that both of the wheels are turning the correct direction by holding the robot up in the air for a while and checking which way the wheels turn when you hold it at different angles? If your motors are not turning the right direction, then you can uncomment lines 44 and 45 in the Balancer example from our Balboa 32U4 Arduino library to fix that.

By the way, I do not recommend testing your Balboa on the edge of a table as shown in your video.

- Patrick

Hi, thank you very much for the answer.

The wheels are turning back and forth synchronized regardless of the angle at which the robot is

It looks like your motors are spinning the correct directions; the little bit of back and forth you are seeing is probably just the result of adjustments the algorithm is making because the motor speeds do not perfectly match. (This will not be as noticeable when your Balboa is actually balancing since the speeds will be much lower than in this experiment where the motors essentially have no load on them.)

So, if you are having trouble getting your Balboa to balance with our example, it is probably just a matter of tuning the control variables. First, I suggest reading this blog post to learn how the balancing algorithm works.

After that you can work on experimentally tunning the control variables in your Balance.h file from the Balancer example project in our library. You will start with providing your overall gear ratio. From there, my recommendation is to set all of the control variables to zero then deal with them one at a time. The comments in Balance.h provide details for how you can determine an appropriate value for each variable.

The unmodified Balancer project is tuned for use with 50:1 high-power gearmotor with carbon brushes, a 45:21 ratio from the plastic gears, and 80mm wheels. If you are using all the same hardware then your values will probably be close to what they are already and some tuning is just required to account for unit-to-unit variation. If you are not using the same hardware then you should probably expect your values to deviate more from those provided.

- Patrick

Hi, I dont know what could happen. I try to change all the variables to know how they affect to the robot behaviour and it changes, but, never near to the balance. In many cases the robot run like a car and it doesnt seem that it will stand up.

Just in case I misinterpreted your video, could you confirm that as you start to lift the Balboa toward a vertical orientation, both wheels start to spin in the direction that would bring it closer to upright (and not the direction that would cause it to lie down again)?

What hardware are you using; specifically, what size wheels, what motors, and which plastic gears are you using? Also, what kind of batteries are you using, and can you confirm they are fully charged?

Can you try the procedure described in the comment near the end of Balancer.ino (lines 161-192), and if you are not able to get the expected results, can you post a video showing what happens instead? It will probably be easier to assess what is going on when you do that test if the wheels are not spinning and trying to move the robot around; you can keep the motors inactive by changing the MOTOR_SPEED_LIMIT value in Balance.h to 0.

- Patrick

The behaviour of the Balboa changed. Now, when I turn on it, its wheels only spin in one direction and it is the oposite to uprtight.

I dont know the hardaware, I only know that the wheels are 80mm long.

I get the results of the lines 161-192 correctly

If that is your Balboa’s behavior when you are running Balancer.ino without any modification (and without any modification to Balance.h), then you should uncomment the motor flipping commands in lines 44 and 45 of Balancer.ino. Can you try that and let me if that improves your results?

If flipping the motor directions does not get you closer to getting your Balboa balancing, then it is going to be hard to get any balancing routine working without knowing what motors and gears you are using. Figuring out what plastic gears you are using should be easy; you just need to remove the gearbox cover to see the gears inside. You can see some diagrams showing how the gearboxes are assembled in the “Assembling the Balboa 32U4 kit” section of the Balboa 32U4 user’s guide.

The easiest way to figure out what gearmotors you have will probably be to find your order information, but if you cannot find that, here is a procedure you can follow. While you have your Balboa’s plastic gearbox open, remove the larger output gear from the gearbox. Load the Encoders example from the Balboa library. If you do not have an LCD for your Balboa, modify the example to report the encoder count output through the Arduino Serial Monitor. When you run the program, manually turn the smaller input gear attached to the gearmotor one revolution and check how many encoder counts the program is reporting. In our example (which counts both edges of both encoder channels for each motor) the encoder reports 12 counts per revolution of the motor shaft, so dividing the result by 12 should tell you the gear ratio of your gearmotor.

- Patrick

I finally do it. But now, I try to introduce this code to stand up by itself but it dont work becuase it dont stand up enough when it stop.

void setup()
{
  // Uncomment these lines if your motors are reversed.
  motors.flipLeftMotor(true);
  // motors.flipRightMotor(true);

  ledYellow(0);
  ledRed(1);
  balanceSetup();
  ledRed(0);

   //stand up for himself
  int32_t speedLeft;
  
  delay(1000);
  for(uint8_t i=0;i<40;i++)
  {
  motors.setSpeeds(-i*20, -i*20);
  delay(10);
  balanceUpdateSensors();
  if(speedLeft < -40)
  {
    break;
  }
  }
 
  for(uint8_t i=0;i<20;i++)
  {
    motorSpeed = i*18;
    motors.setSpeeds(motorSpeed, motorSpeed);
    delay(10);
    balanceUpdateSensors();
    if(angle < 35000)
    {
      break;
    }
  }

Have you tried the unmodified algorithm for standing up from our example (making sure to uncomment the lines to flip your motors as appropriate)? In our example program, you can initiate the stand up sequence by pressing the A button on your Balboa.

- Patrick