ArduCopter Follow Mode

I am trying to follow a car detected by the drone’s camera. I have reliable lat, lon, alt or x,y,z (wrt drone’s home) target positions. How can I use the FOLLOW mode to keep following this target?

Note: the car does not have mavros messages sent out to use the traditional FOLLOW pipeline. Instead I will have to setup a ROS topic that publishes the target position. Any help as to how I can setup this FOLLOW mode on custom positions will be appreciated. Thanks

I see you asked on this thread as well, Follow Mode - Copter

If you read carefully you will find that this type of mission can be achieved with precision landing as described by @rmackay9

Or if you want 3D, you can try this:

So I think I was looking more on the MAVROS side of implementation details, and here’s what I found. Please correct me if you find any faults:

  1. Manually fly the drone and bring the target in camera’s fov
  2. Put the drone in GUIDED mode using
serviceClient<mavros_msgs::SetMode> ("mavros/set_mode")
  1. Start sending waypoints to the drone using
    by publishing to topic mavros/setpoint_position/global
  2. The above message is of GlobalPositionTarget type, which I will populate with waypoint lat, lon, alt.

Question? Assuming the above is correct. Can I just populate the above message with just velocity (Vector3d)? (Instead of the lat, lon, alt)setpoint_position
LINK to mavros setpoint position

or should I use setpoint_velocity

I think you may try on SITL and check as well with Mavlink Inspector from Mission Planner or QGround control. This way you can confirm is signal is in the correct pose and orientation.

That is one way to do it - specifying the location you want the vehicle to go to. Using position is actually not a particularly good way to do it, as the controllers tend to accelerate hard to get up to speed, then decelerate hard to stop on-point. Its recommended that you use the velocity control options you have if you’re going to do it that way.

Your better option is to investigate the onboard “follow” mode. Configure your quad to follow a specific system ID, then stream the position of that vehicle to the quad using GLOBAL_POSITION_INT. This ought to be much, much less work…

I strongly suggest you SITL this first. Altitude frames can be a problem.

Thanks. So I was able to get the drone to move by publishing to setpoint_velocity topic /mavros/setpoint_velocity/cmd_vel_unstamped.

The drone seemed to move East when I gave it some X velocity, and North when I gave it Y velocity. Aka it follow global ENU coordinates. Is this expected behavior? Can someone point me to the correct documentation.

Thank you for taking the time to respond to my queries.

Yeah … that was expected , depending on how you want to implement, there are some existing code for the ENU-NED transformation in MAVROS

ENU is fine for me, any documentation you can point me to that specifies this behavior?

Aka I am looking for documentation that states setpoint_velocity should be in ENU.