super-owesome / bobble_controllers

ROS controllers for self balancing robot, Bobble-Bot.
BSD 3-Clause "New" or "Revised" License
63 stars 15 forks source link

PidControl::getOutput() calls mismatch definition #1

Open MattMgn opened 5 years ago

MattMgn commented 5 years ago

Hi,

I have just noticed a minor bug into your PID controller. The first argument of you PID processing function double PidControl::getOutput(double actual, double setpoint), represents the monitored value and the second one represents the target value.

However, when this function is called by BobbleBalanceController.cpp, it is used like this: DesiredTilt = VelocityControlPID.getOutput(DesiredVelocity, ForwardVelocity); TiltEffort = TiltControlPID.getOutput(DesiredTilt, Tilt); HeadingEffort = TurningControlPID.getOutput(DesiredTurnRate, TurnRate);

From what I understand DesiredVelocity is your target and ForwardVelocity your estimated value, which are inverted regarding your function definition. You might have also a sign reversal somewhere else.

Nice project btw.

Matt

mike-moore commented 5 years ago

Thanks, Matt. I'll revisit this. I vaguely remember fiddling with this during testing on the bot. Agree something fishy is going on here.

jjholleysoe commented 4 years ago

@MattMgn good catch, I'm working this issue now. It requires fixing the bb2 sensor frames to align with the correct PID orientation.