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

Goto/reposition needs to be its own mode and not execute in Hold #14576

Open
MaEtUgR opened this issue Apr 2, 2020 · 5 comments
Open

Goto/reposition needs to be its own mode and not execute in Hold #14576

MaEtUgR opened this issue Apr 2, 2020 · 5 comments
Labels

Comments

@MaEtUgR
Copy link
Member

MaEtUgR commented Apr 2, 2020

Describe problem solved by the proposed feature
As brought up many times before it's undesirable to have the vehicle fly away from it's current position in hold mode and goto/reposition commands https://mavlink.io/en/messages/common.html#MAV_CMD_DO_REPOSITION should get executed in a goto mode and not in Hold mode. This allows dedicating Hold/Loiter mode to pausing what was done before and wait at the current location.

Additional context
This was brought up multiple times by e.g. @hamishwillee @julianoes @DonLakeFlyer

@bresch
Copy link
Member

bresch commented Apr 2, 2020

Yes, I totally agree. If we do that, hold can send zero velocities and NAN position in the triplet, and the drone will stop nicely, without overshoot.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Apr 2, 2020

If we do that, hold can send zero velocities and NAN position in the triplet, and the drone will stop nicely, without overshoot.

To the trajectory generation not the position controller right? Because the trajectory generator takes care to not dirft, the position controller will not do more than integral control and still drift over time.

@dagar
Copy link
Member

dagar commented Apr 2, 2020

I also agree, but keep in mind it might be a little tricky to get this changed cleanly everywhere. At the moment we're dependent on px4_custom_mode.h being manually deployed/copied everywhere and I don't believe there's any real capability check at the mavlink level for this.

Maybe we could do something to get the new mode (and capability check) in place relatively soon to give it time to trickle out. Then in the mean time we could do something like have the new mode operate within HOLD after the first valid DO_REPOSITION is received.

@DonLakeFlyer
Copy link
Contributor

So I was wrong about how I implement actually pausing the vehicle in QGC with PX4 Firmware. It does this:

void PX4FirmwarePlugin::pauseVehicle(Vehicle* vehicle)
{
    vehicle->sendMavCommand(vehicle->defaultComponentId(),
                            MAV_CMD_DO_REPOSITION,
                            true,   // show error if failed
                            -1.0f,
                            MAV_DO_REPOSITION_FLAGS_CHANGE_MODE,
                            0.0f,
                            NAN,
                            NAN,
                            NAN,
                            NAN);
}

QGC doesn't not specifically put the vehicle in Hold flight mode for Pause, the firmware does. I wrote this code ages ago, I vaguely remember some issue that this allow Pause to work in more cases than changing flight mode to Hold. But my memory may be incorrect.

The current problem is that I can't determine when Pause should be enabled since the test for that is the Vehicle being in Hold flight mode.

A more direct method would be Hold really means the vehicle is holding position. QGC enabled pause when flight mode is not Hold and pauses the vehicle by putting it into Hold. Which I believe matches this discussion and how the proposed solution.

@hamishwillee
Copy link
Contributor

A more direct method would be Hold really means the vehicle is holding position. QGC enabled pause when flight mode is not Hold and pauses the vehicle by putting it into Hold. Which I believe matches this discussion and how the proposed solution.

Yes.

should get executed in a goto mode and not in Hold mode

More generic that just a goto mode because we'd also do Orbit in this context. I believe QGC uses the (internal) concept of Guided mode, meaning guided by QGC.

@stale stale bot added the stale label Jul 2, 2020
@PX4 PX4 deleted a comment from stale bot Jul 3, 2020
@stale stale bot removed the stale label Jul 3, 2020
@stale stale bot added the stale label Oct 4, 2020
@PX4 PX4 deleted a comment from stale bot Jan 18, 2021
@stale stale bot removed the stale label Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants