Controlling pitch during SET_POSITION_x messages

Hi all,

I am working on a SLAM type system for obstacle avoidance using GUIDED mode and have few related questions…

I want to maintain a maximum pitch down angle during copter movement to ensure I keep the camera facing any potential obstacles. Yet neither of the SET_POSITION_TARGET_x messages or the DO_REPOSITION command accept any pitch value.

It appears my only option is to also send SET_ATTITUDE_TARGET messages along with the movement messages to control the pitch.

  1. How does a SET_POSITION_TARGET_x compute a trajectory to the given position and altitude? Is it linear, parabolic etc?

  2. How would me also sending SET_ATTITUDE_TARGET messages affect the positional goal in the previous message? Is the trajectory just recomputed with the new attitude or will I be fighting against the position messages?

  3. What’s the best strategy for assessing when a positional target has been achieved? If the trajectory to the position is linear I can just test for height. I’m concerned how SET_ATTITUDE_TARGET messages might affect the path taken to the position.

I appreciate ANGLE_MAX sets the maximum lean angle, but I think I am looking for something more dynamic.