Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Mavlink MOUNT_CONTROL handling #7384

Closed
olliw42 opened this issue Dec 10, 2017 · 9 comments
Closed

Bug in Mavlink MOUNT_CONTROL handling #7384

olliw42 opened this issue Dec 10, 2017 · 9 comments

Comments

@olliw42
Copy link
Contributor

olliw42 commented Dec 10, 2017

even though it is crystal clear that ArduPilot does not have any bug, these lines are wrong:

https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Mount/AP_Mount_Backend.cpp#L42

-> control(0.01f*(float)packet.input_a, 0.01f*(float)packet.input_b, 0.01f*(float)packet.input_c, _state._mode);

https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Mount/AP_Mount_Backend.cpp#L45

-> void AP_Mount_Backend::control(float pitch_or_lat, float roll_or_lon, float yaw_or_alt, MAV_MOUNT_MODE mount_mode)

https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Mount/AP_Mount_Backend.cpp#L58

-> set_angle_targets(roll_or_lon, pitch_or_lat, yaw_or_alt);

these changes imply some follow-up changes higher-up, which are easily found, and thus not listed

@olliw42 olliw42 changed the title BUG in Mavlink MOUNT_CONTROL handling Bug in Mavlink MOUNT_CONTROL handling Dec 10, 2017
@peterbarker
Copy link
Contributor

@olliw42 I'm feeling a bit slow ATM.

Are you suggesting that the call control(...) do the division rather than control(...) itself? (the line number you reference doesn't look like the line below it, so I'm guessing by -> you mean "should be")

AFAICS, with the current strange interface where we pass in either angles or lat/lon precludes us from pre-dividing these numbers.

@olliw42
Copy link
Contributor Author

olliw42 commented Oct 29, 2018

first off, experimentally one of the commands yields 100 times too low gimbal control (that's how I stumbled across it). I believe it is the COMMAND_LONG.
I'm away of this since a while, so my memory is weak, not sure I get it right now, but what I see is:

control() is called from COMMAND_LONG, which appears to be the new official to-be used mavlink, and the other is marked deprecated in the code, I thus would find it natural that control() provides the according interface, i.e. floats in degrees. The _GPS_POINT needs to be factored out, one would e.g. introduce a method to be called from COMMAND_LONG, which has floats too, which I would find natural too to do.
These methods would be used from the deprecated handlers, which would imply moving the division in the angles up.
The alternative would be to just multiply the angles by 100 in the COMMAND_LONG call of control(), but I would consider that a bit weird, since you would go float->int with *100 and then int->float with /100. And moreover one would give the deprecated the preference. So I suggested the former path in the above.

yes, the "->" point to what I think it should become

hope that helps a bit

Note, the issue wasn't there in AC3.5.x. It - so it appears - was introduces without properly considering the side-effects and without proper testing, and without following the "bread crumps". Maybe a general lesson to be learned here.
(and maybe a lesson for other mount stuff too ;) experimental facts are experimental facts ;) ).

@peterbarker
Copy link
Contributor

peterbarker commented Oct 29, 2018 via email

@olliw42
Copy link
Contributor Author

olliw42 commented Oct 29, 2018

once pointed at it I considered it obvious from the code
sorry if I wasn't clear

@amilcarlucas
Copy link
Contributor

@peterbarker what is the status on this?

@IamPete1
Copy link
Member

Looks like this was fixed by #9288, @peterbarker ?

@peterbarker
Copy link
Contributor

@IamPete1 AFAIK this problem is as yet unsolved and we can't get to there from here. IIRC its basically a degrees vs centidegrees issue

@rmackay9
Copy link
Contributor

@olliw42,

Maybe we can close this now? Again, sorry it took so long.

@olliw42
Copy link
Contributor Author

olliw42 commented Feb 3, 2023

closing it since resolved :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants