PX4 / jMAVSim

Simple multirotor simulator with MAVLink protocol support
BSD 3-Clause "New" or "Revised" License
84 stars 208 forks source link

fix bug in body-fixed XYZ Euler angles continued #37

Closed bkueng closed 8 years ago

bkueng commented 8 years ago

obsoletes #36

mpaperno commented 8 years ago

Has anyone tested this in actual use? I don't understand what is going on here... you just rotated the vehicle and gimbal 90 deg., but not the rest of the world? How is this backwards compatible with anything currently working?

-Max

kd0aij commented 8 years ago

@mpaperno This fixed an incompatibility with PX4/Firmware. I'm not aware of other users of PX4/jMAVSim; DrTon/jMAVSim is unchanged

mpaperno commented 8 years ago

This fixed an incompatibility with PX4/Firmware.

Didn't anyone use jMAVSim with PX4 before this fix? Or was it always broken?

I'm not aware of other users of PX4/jMAVSim; DrTon/jMAVSim is unchanged

@LorenzMeier indicated earlier this is the new master for jMAVSim in general. DrTon's version is no longer maintained/updated/gets any response, otherwise I would have submitted all my previous updates to him instead. There is clearly code in there now to support different autopilots. Which I took the time to do instead of making everything specific for the AP I use. This is done to keep the versions compatible and any improvements easier to carry over/merge as-is.

And you didn't answer my first question.

-Max

bkueng commented 8 years ago

@mpaperno This swaps roll & pitch axis for the attitude. I consider this a bug fix, since the previous implementation did not comply with NED (It's not documented within jMAVSim, but that's the standard we are using). I tested this within PX4 and found nothing wrong, so could you please explain what exactly breaks for you? Yes this is the new official version, so external projects should be able to use this, and I do care about their compatibility.

kd0aij commented 8 years ago

@mpaperno Sorry, thoroughly tested by me at least. Please let me know if your testing indicates any actual issues with other systems.

kd0aij commented 8 years ago

@mpaperno And yes, I've been a user of and contributor to PX4 and jMAVSim for several years.

mpaperno commented 8 years ago

OK, thanks for clarifying that Beat. I see now that attitude is something I added and it is (or was) only used for the gimbal. I agree pitch & roll were swapped -- IIRC this was done to get the gimbal working properly but w/out anyone needing to swap their gimbal roll/pitch channels. Perhaps it's better this way in the long run, and the attitude is now shown properly in the reporting output.

I do see attitude is now being used in the HIL_STATE_QUATERNION message... another way to get the quats would be right from the rotation matrix (same thing as attitude is derived from):

Quat4f quaternion = new Quat4f();
quaternion.set(vehicle.rotation);

-Max