Developer

### PX4 Segway Robot

My roboclaw/pololu based segway is working well now with the new motors. I have closed the attitude loop with the gyros and the EKF pitch estimate. I will soon close the position loop with the encoders.

You need to be a member of diydrones to add comments!

#### Comments

• Someone should work on indoor mapping via rover.

• Developer

Jason, if you were referring to not numerically taking the derivative of the pitch signal, I'm not. I'm using the pitch rate from the gyros for the D term. I am not using the encoder wheel speed, but I get the same effect.

• Developer

Hey thanks Jason! I have a full simulation in scilab with PIDs working for position control but agree that it is difficult especially with a short robot. I started with a  robot about the same size as the arduroller (https://www.youtube.com/watch?v=dXdAo7b8_Hs) but changed to this new taller design to make the system naturally more stable. When I had the really short robot it creates an extremely fast unstable pole out that is hard to drag back to stability with the zero from the PD controller. Another trick that I found is that putting the PD controller in the feedback loop instead of the feedforward loop eliminates a closed loop zero that can be nasty when closing the position loop. I'm actually playing around with this as part of a system id course and am using an EKF online to estimate the mass and position of the pendulum. My goal is to use a linear quadratic gaussian (LQG) controller to stabilize the system with the estimated mass and length of the pendulum. It has been really challenging so far, but fun. All of my source code will be part of the PX4 firmware. I will have code for identifying the motor transfer function as well which should be useful.

• Developer

Your welcome to play around with my rollerbot code

https://github.com/jason4short/ardupilot/tree/ArduRoller

I found the control loops need more than PIDs can deliver.

check out

static int16_t
get_velocity_pitch()
{
//cliSerial->printf_P(PSTR("ws:%d, se:%d\n"), wheel.speed, speed_error);
return g.p_vel * (float)wheel.speed; /// 1.8
}
This will make it so you can navigate and respond to outside impulses.
Jason
jason4short/ardupilot
Contribute to jason4short/ardupilot development by creating an account on GitHub.
• Developer

The current source code is here if anyone is interested. Hopefully it will be merged with PX4 master soon.

https://github.com/jgoppert/Firmware/tree/roboclaw

We are going to use this as part of an undergraduate aero/astro engr. controls lab at Purdue. Closing the position loop with the encoders should be fairly trivial at this point and then it should be very fun integrating manual rc control and gps waypoint following which should also be trivial using the PX4 firmware.

jgoppert/Firmware
PX4 Firmware for PX4FMU autopilot and PX4IO servo / failsafe board - jgoppert/Firmware
• Very Cool!  I'm curious about these self balancing types.

• Fist-bump robot.

This reply was deleted.