mavlink / MAVSDK

API and library for MAVLink compatible systems written in C++17
https://mavsdk.mavlink.io
BSD 3-Clause "New" or "Revised" License
633 stars 510 forks source link

offboard::set_position_velocity_ned #1532

Open ucas-zihaowang opened 3 years ago

ucas-zihaowang commented 3 years ago

Hello,

In the funtion Offboard::Result Offboard::set_position_velocity_ned( PositionNedYaw position_ned_yaw, VelocityNedYaw velocity_ned_yaw);

What does VelocityNedYaw mean? Average velocity in each direction ? Actual flying, I set different VelocityNedYaw, the fly speed is always too fast.

Thanks.

julianoes commented 3 years ago

It's actually a bit confusing. I believe what the speed sets is the "feed-forward" term for the control. @Jaeyoung-Lim or @MaEtUgR maybe you can explain it better.

Jaeyoung-Lim commented 3 years ago

@happyzihao Could you elaborate on what do you man by too fast? Is it moving faster than the desired setpoint velocity?

julianoes commented 3 years ago

@happyzihao you can limit the speed using the param MPC_XY_CRUISE.

The velocity that you add to the MAVSDK interface is a control feed-forward.

julianoes commented 3 years ago

Note to self: we should describe that better in the API docs.

PeymanAmirii commented 2 years ago

Thanks for your answers. In control, feed-forward usually used for disturbances or outer effects. How do you use velocity as feedforward? For example the current point is [0, 0, 0] and the desired one is [10, 0, 0]. If we use set_position_velocity_ned(PositionNedYaw(10, 0, 0, 0),VelocityNedYaw(1, 2, 0, 0)), what happens?

julianoes commented 2 years ago

Without getting into the details of controls, what are you trying to do?

PeymanAmirii commented 2 years ago

I want the quadcopter to fly from its current point A to point B. I want to know what happens if vecotors AB and target velocity have different directions and we use the command set_position_velocity_ned(PositionNedYaw(B_north, B_east, B_down, 0),VelocityNedYaw(target_velocity_north, arget_velocity_east, arget_velocity_down, 0)).

julianoes commented 2 years ago

You want to fly from A to B, ok. And then you lost me.

PeymanAmirii commented 2 years ago

Thanks for your answer. What I am trying to say is that we can send target velocity and target position using the command set_position_velocity_ned. Conisder that a drone is at point A and we set point B as the target point and also we consider a target velocity vector for the dorne. If we use the command set_position_velocity_ned to send the target velocity and pont but the vector from point A to B has different direction with target velocity, then what happens? (I think that target velocity and vector from A to B should always have the same direction, but how the command handles the case if they don't have the same direction)

julianoes commented 2 years ago

Ok, so I think the PX4 controller will go in a straight line between A and B. However, if you, for instance know that there is a strong wind coming from one side you could command the feedforward against that wind and therefore the controller would be able to resist the wind better (at least initially) because it doesn't need to be perturbed by the wind first to find out that it needs to correct for it, but instead you can fight it earlier.

If your feedforward is not against wind but just wants to fly somewhere else, let's say to fly a round trajectory, then you will essentially fight the position controller, and you'll end up with something in between, based on your tuning and how strong your feedforward is.

Does that make sense?

PeymanAmirii commented 2 years ago

Thanks. So I think when we send both the target velocity and target position, the output is a sum of the outputs of the separate position controller and velocity controller. Therefore, they can conflict with each other.

julianoes commented 2 years ago

Right.