-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
px4io: When running HITL, don't publish actuator_outputs. Fixes #13471. #13488
Conversation
…3471. When running in HITL mode, pwm_out_sim publishes actuator_outputs. px4io unconditionally publishes the uOrb actuator_outputs. When HITL is configured, the px4io copy of the uOrb has all zeros. The result is that there are two publications, one valid, and one all-zeros. This causes the HIL_ACTUATOR_CONTROLS mavlink message to be incorrect (all-zeros) and the SERVO_OUTPUTS_RAW mavlink message to be inconsistent, as it takes the data from one or the other uOrb randomly each cycle. The fix is to let px4io know that HITL is in effect when it is started, and modify px4io to suppress publication in this case. This is a bigger more complicated fix than I would like, but I think it is conceptually correct. Signed-off-by: Nik Langrind <[email protected]>
Thanks, this is something that's been broken multiple times. |
@julianoes @dagar Do we want to pull this into 1.10? I'm tending towards it. |
rc_handling_disabled = true; | ||
|
||
} else if (!strcmp(argv[1], "hil")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be: strcmp(argv[extra_args], "hil"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, thanks, I will fix. Good eye!
Yes, I'll backport it. |
@bkueng could you please backport it. It's conflicting and I'm not aware of what has been going on here. |
@bkueng @julianoes - #13531 is a PR of a cherry pick from master into release/1.10 with the conflict resolved. I hope this makes your work easier. But if not, please decline it. |
See Issue 13471 - vehicle doesn't take off in HITL SIM
The reason it fails:
When running in HITL mode, pwm_out_sim publishes actuator_outputs.
px4io unconditionally publishes the uOrb actuator_outputs. When HITL
is configured, the px4io copy of the uOrb has all zeros.
The result is that there are two publications, one valid, and one
all-zeros. This causes the HIL_ACTUATOR_CONTROLS mavlink message
to be incorrect (all-zeros) and the SERVO_OUTPUTS_RAW mavlink
message to be inconsistent, as it takes the data from one or the
other uOrb randomly each cycle.
The fix is to let px4io know that HITL is in effect when it is
started, and modify px4io to suppress publication in this case.
This is a bigger more complicated fix than I would like, but I
think it is conceptually correct.
An alternative would be to change src/modules/mavlink/mavlink_messages.cpp so that
MavlinkStreamHILActuatorControls() explicitly subscribed to instance 1 of the uOrb:
That's a one-line solution, but I think it is incorrect because nothing enforces which pub of the uOrb is instance 0 and which is instance 1. And, I just think it doesn't make sense to have two pubs.
Test data / coverage
I simply verified that the failure case in #13471 is fixed. I also verified that the Pixhawk still boots when HITL is not enabled.
Signed-off-by: Nik Langrind [email protected]