ethz-asl / mav_trajectory_generation

Polynomial trajectory generation and optimization, especially for rotary-wing MAVs.
Apache License 2.0
549 stars 225 forks source link

How could I set up drone physical constraints (such as maximum horizontal and vertical velocity and acceleration, maximum height and flight distance) #42

Closed frontw closed 7 years ago

frontw commented 7 years ago

Hi, developers!

Could you, please, consult me how could I set up drone physical constraints such as

Thank you!

rikba commented 7 years ago

Dear @frontw ,

consult me how could I set up drone physical constraints

There are two ways. Either use the linear optimizer without constraints and then check the constraints of the trajectories using https://github.com/ethz-asl/mav_trajectory_generation#checking-input-feasibility . Or use the non-linear optimizer and set maximum magnitude constraints on velocity, acceleration, jerk or snap https://github.com/ethz-asl/mav_trajectory_generation#nonlinear-optimization .

maximum horizontal velocity; maximum and minimum vertical velocity;

The current implementation only allows checking for the absolute maximum velocity, both in the non-linear and the posterior feasibility check.

maximum horizontal acceleration; maximum and minimum vertical acceleration;

Same for the acceleration, we only check for the magnitude. Note that we assume a rigid body model and vertical props. Acceleration only occurs in the thrust direction of the props and the gravitational acceleration.

maximum height and flight distance.

You can check a segment for maximum flight height using the half space feasibility check. Flight distance is currently not implemented. But you could implement a method that computes the flight distance of a segment.

There is also addConstraint function and I could set constraints on different derivative_order, but, I think, it is equality constraint, not inequality.

I belief you are referring to opt.addMaximumMagnitudeConstraint(mav_trajectory_generation::derivative_order::VELOCITY, v_max);. The constraints are handled as a soft constraint in the cost function of the optimization (see Burri et al.). Thus they act like inequality constraints. However, the time of the segment is minimized such that most of the time one of the constraints will be met.

Hope I could help.