SET_ATTITUDE_TARGET with Guided_No_GPS, lack of documentation

I played a bit with SET_ATTITUDE_TARGET in SITL and I see that WPNAV_ACCEL_Z parameter is taken into account for vertical velocity. What about other WPNAV_* parameters like WPNAV_SPEED, WPNAV_ACCEL or WPNAV_JERK? Are they taken into account for horizontal velocity or maybe there are some other useful parameters which can affect the control?

SET_ATTITUDE_TARGET doesn’t use these but SET_POSITION_TARGET does.

1 Like

There was one issue I faced some time ago. I created a hack for it, but maybe there is a proper way to handle this. When I switch to GUIDED_NOGPS, the copter automatically turns north, because this is how attitude quaternion is initialized (1, 0, 0, 0) in angle_control_start method. So I just replaced it with zero quaternion (0, 0, 0, 0) and now there is no automatic north rotaion. Is there a better way to handle this?

Did you create an issue for this?

I would think that GUIDED_NOGPS should be initialised at the current attitude.

Is there a better way to handle this?

What you have done may actually do the same thing but the correct initialisation would be the current target attitude. I would need to check the code to work out exactly what the right formulation of this would be.

Would you create an issue in git for this problem. Your words above would be enough and assign me to it.

1 Like

Probably don’t have rights to assign you, so here is an issue

1 Like

Thanks for that. I realised I didn’t explain why I asked you to create an issue. We try to give credit on git for where the ideas and issues come from. It also makes it easy for me to talk to you about checking any fixes that we make.

Thanks for telling us about this!!!

2 Likes

I am setting the attitude target at a frequency of 200Hz with a specified thrust level, but I’ve encountered something unusual. I input a values for roll, pitch, and yaw, but there are times when the drone doesn’t respond as expected, but can move even in opposite direction. I wonder if using a 200Hz frequency is excessive and if updating the attitude too frequently might be hindering its response to my commands. Also, is it normal that i tell it to move right, but it moves left?

I am using 4.4.4.

By the way, is it possible to have a thrust level from -0.5 to 1? so when i set it to -0.5 it reverses the spin of the motors.

Typically 50Hz is the limit.

1 Like

What happens if i exceed the limit?

Strange things that the Devs never see, because they know better then to cross the limit.

@amilcarlucas That wasn’t helpful.

@Iuliu Sorry. I will try to answer your question.

The maximum rate any message can be acted on in the fight controller is the loop rate. That is normally 400 Hz. However you will find that you can’t communicate fast enough with the flight controller before you hit that limit. On time critical applications I try to maintain 100 Hz. To do that you need to turn off any unnecessary Mavlink messages. With higher bitrates you may be able to reliably go faster but for direct attitude control you are not going to see much improvement past that.

No. But we are getting into silly question territory here. You have a problem with your command or the aircraft.

Not on a standard multirotor. This is possible on a collective pitch multirotor but that frame is more experimental so I would expect more problems and less support going down that rout.

1 Like

I learned something, thanks.

1 Like

I discovered the reason behind the issue : my software was continuously pushing the hardware to its limits, leading to situations where I lost control over the aircraft. The rapid turns and inertia caused the aircraft to begin spinning uncontrollably.

Thanks for letting me know! I had it in the back of my mind that I would like to have something like that built, but didn’t realize it exists.

Besides the drone tuning, what other parameters affect the drone’s ability to maintain a SET_ATTITUDE_TARGET? I have an issue where my drone sometimes struggles to adjust the last 2-5 degrees, while at other times, it follows exactly as intended.

Increasing the PID values makes the drone more responsive to the SET_ATTITUDE_TARGET, but it becomes difficult to fly manually afterwards.

SET_ATTITUDE_TARGET uses almost exactly the same attitude control as manual flight so your tuning impacts both equally. If you are finding it difficult to fly manually then SET_ATTITUDE_TARGET will be compromised in the same way.

The only parameters that impact the attitude control of SET_ATTITUDE_TARGET is the attitude control tuning parameters (ATT_blabla).

It is pretty common that aircraft don’t close the last 1 or 2 degrees. If this is blowing out to 5 degrees then it may be a combination of aerodynamic forces, less than ideal tune, or some other setup or design problem. The main design feature that exaggerates this problem is flexible propellers.

The short answer is that improved tune will reduce angular errors but if you are seeing problems with your manual flight performance then you still have a poor tune.

1 Like

Do you know if there are any plans to support SET_ATTITUDE_TARGET for planes? If you start understating how to use it, it’s quite a powerful feature.