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

Support Ardupilot #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Support Ardupilot #6

wants to merge 3 commits into from

Conversation

mhl787156
Copy link
Member

This PR adds support for ardupilot.

Primary change is for enabling GUIDED mode, and the requirement (I think) to takeoff before setpoint_position is accepted.

Still WIP, Ardupilot vehicle arms, switches to guided mode, but will not takeoff. Currently returns a 4 status on takeoff
pointing to Coordinate frame not supported (https://mavlink.io/en/messages/common.html#MAV_CMD_ACK_ERR_NOT_SUPPORTED)

@mhl787156 mhl787156 requested a review from rob-clarke November 3, 2021 16:08
rob-clarke
rob-clarke previously approved these changes Nov 5, 2021
@mhl787156
Copy link
Member Author

[Note this is not actually complete yet xD I was hoping you might be able to provide some input as to how to get an AP drone flying 🤣 ]
Currently for AP:

  1. ARM
  2. Change to GUIDED
  3. Use Takeoff -> it returns a code 4

@rob-clarke
Copy link

rob-clarke commented Nov 8, 2021

I suspect this is caused by the interference of the SITL default rangefinder. In GUIDED mode, any takeoff altitude less than the rangefinder maximum altitude (by default 50m) sets the frame of the takeoff waypoint to ABOVE_TERRAIN (Source). Then, when the autopilot attempts to set the destination, it fails. Potentially due to missing terrain data.

@rob-clarke
Copy link

rob-clarke commented Nov 8, 2021

However, one would think that this should be caught by the ...terrain_source() == ...TERRAIN_FROM_RANGEFINDER line.

@rob-clarke
Copy link

I think it's actually this part:

if (takeoff_alt_cm <= copter.rangefinder_state.alt_cm) {
            return false;
        }

The altitude reported by the SITL range finder under Gazebo seems to be constantly the maximum, here 5000cm or 50m

@mhl787156
Copy link
Member Author

Is there even a rangefinder on the model? Where do the rangefinder measurements come from?

@rob-clarke
Copy link

Not entirely sure, I think there is a rangefinder simulator built in to the SITL binary itself which may be being used?

@rob-clarke
Copy link

Now that the vehicle can take off, there still appear to be problems... Lots of "Waiting for Navigate" messages.

I've added a branch to disable the rangefinder for the ArduPilot SITL in the main repo. Once that is built, you can use uobflightlabstarling/starling-sim-ardupilot-copter:disable-rangefinder to test.

@rob-clarke rob-clarke dismissed their stale review November 8, 2021 13:09

Not yet working

@mhl787156
Copy link
Member Author

The waiting for navigate messages are that thread blocking until the drone has reached the navigation target. If you want a quick way of running, call the navigate service directly with argument {"z: 2, auto_arm: true'}

@mhl787156
Copy link
Member Author

Do you observe the drone moving around on gazebo?

@rob-clarke
Copy link

It gets off the floor but just stays hovering at 2m

@rob-clarke
Copy link

Now it takes off, then hovers in place while I assume the trajectory follower goes round the trajectory, then lands.

@mhl787156
Copy link
Member Author

Hmm sometimes it takes a little bit to stabilize after takeoff for it to trigger the 'i'm here'...

@rob-clarke
Copy link

The not moving was likely caused by the (recently fixed) error in the bridge yaml files. However, using nightly where the fix is implemented results in no takeoff again. My guess is that sending the setpoints somehow disturbs the takeoff sequence. With no setpoints being sent, the takeoff completes, if setpoints are sent, the vehicle doesn't leave the ground...

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

Successfully merging this pull request may close these issues.

2 participants