Closed sytelus closed 5 years ago
Looks like @lovettchris already tried this change https://github.com/PX4/jMAVSim/pull/41. BTW, the reason GPS is 0,0 because lat and lon fields of HIL_STATE_QATERNION are not set. Also alt is set wrongly to z instead of projected value of z.
@kd0aij, @bkueng I think I now understand the purpose of HIL_STATE_QUATERNION . So basically, HIL can be used in two modes: (1) "state-level" mode (2) "sensor-level" mode. In Mode 1, pose estimation is disabled. This mode is useful for high throughput simulation where you don't care about errors from sensors. Mode 2 is normal simulation mode where pose estimation is enabled. Mode 2 should be the default and should be used majority of the times. So basically jMavSim should provide a command line switch to select one of these two modes instead of always sending HIL_STATE_QUATERNION all the time as it is doing now and thus always enforcing Mode 1.
Reference: https://pixhawk.org/dev/hil/start
The reference is outdated and I don't think we support state-level HIL anymore. As I wrote in https://github.com/PX4/jMAVSim/pull/41#issuecomment-255348808, HIL_STATE_QUATERNION is only used for logging.
@bkueng do we still need this for logging? #82 would not be needed then.
Yes it is, as it provides the ground-truth.
Ah ok.
Recently user @kd0aij added HIL_STATE_QUATERNION message along with few other changes such as removing nav_mode check. This is causing following issues:
The cause of this is below problem is in the implementation:
Additionally, I also think this message is possibly interfering PX4 autopilot. See the function
MavlinkReceiver::handle_message_hil_state_quaternion(mavlink_message_t *msg)
in the PX4 code.I reverted the MAVLinkHILSystem.java file to version before Sep 1 and above problems went away with vehicle having stable flight.