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

AP_HAL_SITL: initialize rcout safety state #27611

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

robertlong13
Copy link
Collaborator

This allows BRD_SAFETY_DEFLT=1 to work correctly for SITL.

@IamPete1
Copy link
Member

I would have expected a change in AP_HAL_SITL why does it need to be in the vehicle?

Copy link
Contributor

@khancyr khancyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks wrong.
you can pass BOARD_SAFETY_ENABLE_DEFAULT 1 to force it . I don't think that using safety button on SITL is convenient things

@robertlong13
Copy link
Collaborator Author

robertlong13 commented Jul 22, 2024

looks wrong. you can pass BOARD_SAFETY_ENABLE_DEFAULT 1 to force it . I don't think that using safety button on SITL is convenient things

Nope, that doesn't work. That's exactly what this PR is fixing. The entire BRD_SAFETY_DEFLT parameter is broken in SITL. This change has no impact by default.

As for why I wanted this change:

  1. I was trying to reproduce a bug in SITL that I was only able to reproduce on Cube. I was trying to see if safety had anything to do with it (it didn't) but there's no way at all for SITL to start with the safety switch on at boot.
  2. Simulation training.

@robertlong13
Copy link
Collaborator Author

I would have expected a change in AP_HAL_SITL why does it need to be in the vehicle?

Yeah, looking at this in the cold light of day, I have no idea why I thought this was the best place to do this 😆. Fixed.

@robertlong13 robertlong13 changed the title AP_Vehicle: init safety state for SITL at boot AP_HAL_SITL: initialize rcout safety state Jul 22, 2024
Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. BRD_SAFETY_DEFLT is zero in SITL, so this should have no change in behavior unless you change it.

peterbarker and others added 2 commits July 29, 2024 19:21
for reasons I can't fathom, defaulting the rangefinder state causes problems with the vehicle orientation in SITL - probably a state update fix somewhere.

This test was kind of broken anyway - the RangeFinder was pointing latterally out from the vehicle, but is displayed forward of the vehicle (ther RANGEFINDER mavlink message conveys no orientation information)
This allows BRD_SAFETY_DEFLT=1 to work correctly for SITL.
@peterbarker
Copy link
Contributor

I've rebased this on a fix for Rover's RangeFinder test.

I think what's happening is that the vehicle used to move forward a little but the change in safety state stops that happening.

We used to point the rangefinder laterally,so moving forward brought it in-line with the post.

Very strange.

@peterbarker peterbarker merged commit 64fc60c into ArduPilot:master Jul 29, 2024
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants