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

The use of drone.offboard.set_position_ned #691

Open
jupiterMJM opened this issue May 8, 2024 · 9 comments
Open

The use of drone.offboard.set_position_ned #691

jupiterMJM opened this issue May 8, 2024 · 9 comments
Labels

Comments

@jupiterMJM
Copy link

Hey everyone,
I want to move the drone one meter to the east (for exemple). As the documentation does not help very much, I thought that I could do that with drone.offboard.set_position_ned . However, when I simulate it under gazebo, it does not work very well and does strange stuff.
Therefore, did anyone yet use it? Or know how to do the thing I wanna do?
Thanks in advance!

@julianoes
Copy link
Collaborator

What do you mean with strange stuff?

One thing to note is that it is relative to your current position. Also see: #684

@jupiterMJM
Copy link
Author

Thanks for your reply! After, digging into the log through QGroundControl, I've think I've figured out that drone.offboard.set_position_ned(0, 0, 0, 0) was kinda equivalent to "go back home". Which is not what I wanna do! What I wanna do is:
1/ arm; takeoff the drone and go to a random location (thx to goto_location)
2/ hold for a few second there
3/ move the drone meter after meter according a custom pattern along North, East and Down.
Therefore my questions are:

  • is drone.offboard.set_position is done for that? or exists another way to do such thing?
  • to initiate the drone.offboard I have to provide initial NED coordinates. To do so, and whithout moving the drone, do I have to do: drone.offboard.set_position_ned(current_north_position_in_NED, current_east_position_in_NED,current_down_position_in_NED). If so, how can I get those info?
  • is there a way to make "set the new NED home here"?
    Thanks a lot for your answers

@jupiterMJM
Copy link
Author

Okay, so I've succeeded into making such a thing BUT i can't provide the speed I want to apply during the move. Attached, you will find a piece of code (to move) and the picture of the trajectory.

# fonction pour bouger relativement au drone selon le nord/sud/est/ouest
async def move_by(drone:System, north:float, east:float, down:float, yaw:float = 0):
    """
    ATTENTION, FONCTION A EFFET DIRECT SUR LE DRONE; NE PAS UTILISER LA FONCTION SANS REFLECHIR AUX CONSEQUENCES
    """
    global position_du_drone_souhaitee
    print("yo")
    ajout = [north, east, down]
    if await drone.offboard.is_active():
        position_du_drone_souhaitee = [position_du_drone_souhaitee[i] + ajout[i] for i in range(len(position_du_drone_souhaitee))]
        next_point = PositionNedYaw(*position_du_drone_souhaitee, yaw)
        speed_ned = VelocityNedYaw(1, 0, 0, 60)
        accel_ned = AccelerationNed(1, 0, 0)
        await drone.offboard.set_position_velocity_ned(next_point, speed_ned)
        # await drone.offboard.set_position_ned(next_point)
    else:
        print("offboard non activated")

image
The color gives the speed in m/s.

@julianoes
Copy link
Collaborator

Right, that's always a question: how to set the speed, and unfortunately I don't have a good answer because the normal parameters are not applied in offboard control.

One way is to use velocity control but that requires to close the loop on the outside which is not always what you want to do.

@Jaeyoung-Lim do you know of a way to limit the speed? Could we add a param?

@jupiterMJM
Copy link
Author

Mmmh; okay. But if we can't set the speed what is the aim of the function drone.offboard.set_position_velocity_ned ? I thought that it was a way to provide a target point and the speed to go with to.

@julianoes
Copy link
Collaborator

The speed is a feed forward speed control, not the max speed. I would find max speed more intuitive as well but that's what PX4 exposes, unfortunately.

@jupiterMJM
Copy link
Author

Okay, by the way, I see this "feed forward speed control" everywhere. But what does it exactly mean? Physically at least? thanks

@julianoes
Copy link
Collaborator

It's the feed foward of the controller. https://en.wikipedia.org/wiki/Feed_forward_(control) I think it's unfortunate because it's not beginner friendly, but it does allow for more aggressive flying.

@arpitpara
Copy link
Contributor

Thanks for your reply! After, digging into the log through QGroundControl, I've think I've figured out that drone.offboard.set_position_ned(0, 0, 0, 0) was kinda equivalent to "go back home". Which is not what I wanna do! What I wanna do is: 1/ arm; takeoff the drone and go to a random location (thx to goto_location) 2/ hold for a few second there 3/ move the drone meter after meter according a custom pattern along North, East and Down. Therefore my questions are:

* is drone.offboard.set_position is done for that? or exists another way to do such thing?

* to initiate the drone.offboard I have to provide initial NED coordinates. To do so, and whithout moving the drone, do I have to do: drone.offboard.set_position_ned(current_north_position_in_NED, current_east_position_in_NED,current_down_position_in_NED). If so, how can I get those info?

* is there a way to make "set the new NED home here"?
  Thanks a lot for your answers

Why don't you try offboard from csv example?
I've been working with off-board mode from quite a while now and it seems to work fine for me with GPS and GPS-denied environments to with minimal changes.

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

3 participants