RoboticExplorationLab / RobotZoo.jl

MIT License
26 stars 11 forks source link

Quadrotor model accepts negative control input affecting output moment #6

Closed a6a3uh closed 2 years ago

a6a3uh commented 2 years ago

https://github.com/RoboticExplorationLab/RobotZoo.jl/blob/6ceea23bc39b132c0e0e0cf83319197752214c9c/src/quadrotor.jl#L96

Force calculation explicitly uses max(0, u[i]) to account only for positive control command. Meanwhile moment calculation does not rejects negative control inputs.

Indeed optimal control calculated in https://github.com/RoboticExplorationLab/TrajectoryOptimization.jl/blob/master/examples/Quadrotor.ipynb calculates control with negative inputs found in each of 4 control channels which in turn affect dynamics. Either Quadrotor example should explicitly apply bounds on control or Quadrotor model should reject negative control inputs.

a6a3uh commented 2 years ago

Sorry. Bound on control is defined in TrajectoryOptimization Quadrotor example. And Altro solver obeys these bounds, meanwhile iLQRSolver solver doesn't and produces solution with negative controls and error message MethodError: no method matching max_violation(::Altro.iLQRSolver... But this might be a subject for another issue.