"Follow me" for camera gimble control

Hi everyone, my first post so take it easy on me if i’ve placed under the wrong subforum.
I’m wanting to the use the apm 2.5 setup with a tarot gimble to allow for 2 types of “follow me”.
The first is already in place, i.e the copter following the operator, but I can’t seem to find a solution that allows the camera control to also follow that “moving point”.
I found the ability to point the camera at a fixed point, but not to have that location come from the "follow me " location that is already being read by the code. This would then allow the copter to be positioned at say 45deg back, 20m high and 30 meters away and track along side you, whilst the gimble does the pointing and filming.
Have i missed something, has this been written in, if not then I’ll have a go as to me just means udapting the original static position to a new position using the position from the ground control unit and some trig functions.

Thanks in advance

J

OK so thought i’d carry on doing some digging as i’m a complete noob to this software, and just place what i come across in this thread as i go.
So assuming that only a 2d gimble is to be used (for simplistic install) then the yaw will have to be set in order to get the camera pointing at the right location as it is hoped to get the copter to sit in any position around you then maintain that offset wherever you go. (rather than ‘follow me’, perhaps ‘shadow me’ or ‘copy me’ is a better term?!)
So starting with the basics, to set the yaw is in the
Follow me _
state.cpp _
mavlink_msg_mission_item_send() _
identified as /* float param4 : desired yaw angle at waypoint */

this value could be easily added as one of the follow me user entered parameters as it wouldn’t change (I assuming that yaw is the heading, not a rate of turn?) and that the value given to yaw would be 180deg different to that entered by the user.

For example, i want to set the copter at altitude of 20m, at a distance away from me of 25m and sit at 45deg (assuming i’m facing north at the time), so would be setting the yaw at 225 deg.

what i can’t find is where the offs_lat and offs_lon have their parameters set.

Hi,

I’m very new to this so please excuse my ignorance, but noticed you have found a way to keep the camera pointed at a fixed position. I am interested in being able to do this, can you tell me how or point me in the right direction? I will (eventually) be using a quad/hex with PX4 and 3 axis gimble.

Many thanks,

Andy

Hi andy, from what I’ve seen it appears to be available under ‘circling’ option

so carrying on, it appears that the option to set the offsets is not available in the mission planner, but the variables are in place, so could be set at compile time, if you always wanted the copter sat, say, behind you and off to the right.

in the mount.cp file in the libaries folder, the code their already allows for pointing the camera at a point set in mission planner,

#if MNT_GPSPOINT_OPTION == ENABLED
// set the target gps location
_target_GPS_location = *target_loc;
// set the mode to GPS tracking mode
set_mode(MAV_MOUNT_MODE_GPS_POINT);
#endif

one assumes if getting that target position info from mission planner then its just a simple case of setting that target location to be the GCU location which is already present as a variable within the system.

Whilst on this subject, how can one request to have variables etc added to the mission control/andropilot?

ok, so more info,
in ap_mount.cpp
function below is called;

[code]void AP_Mount::set_roi_cmd(const struct Location *target_loc)
{
#if MNT_GPSPOINT_OPTION == ENABLED
// set the target gps location
_target_GPS_location = *target_loc;

// set the mode to GPS tracking mode
set_mode(MAV_MOUNT_MODE_GPS_POINT);

#endif
}[/code]

this relates, i think, to the function in gcs mavlink file:

case MAV_CMD_DO_SET_ROI: tell_command.p1 = packet.param1; // MAV_ROI (aka roi mode) is held in wp's parameter but we actually do nothing with it because we only support pointing at a specific location provided by x,y and z parameters break;

which gets its location from

// XXX receive a WP from GCS and store in EEPROM case MAVLINK_MSG_ID_MISSION_ITEM: {

which is sent data from the follow me state.cpp file:

mavlink_msg_mission_item_send( upstream_channel, /* mavlink_channel_t chan*/ _target_system, /* uint8_t target_system */ _target_component, /* uint8_t target_component */ 0, /* uint16_t seq: always 0, unknown why. */ MAV_FRAME_GLOBAL, /* uint8_t frame: arducopter uninterpreted */ MAV_CMD_NAV_WAYPOINT, /* uint16_t command: arducopter specific */ 2, /* uint8_t current: 2 indicates guided mode waypoint */ 0, /* uint8_t autocontinue: always 0 */ 0, /* float param1 : hold time in seconds */ 5, /* float param2 : acceptance radius in meters */ 0, /* float param3 : pass through waypoint */ 0, /* float param4 : desired yaw angle at waypoint */ x, /* float x : lat degrees */ y, /* float y : lon degrees */ z /* float z : alt meters */ ); }

which gives the positional info used
back the in gcsmavlink function MAVLINK_MSG_ID_MISSION_ITEM:

tell_command.lat = 1.0e7f * packet.x; // in as DD converted to * t7 tell_command.lng = 1.0e7f * packet.y; // in as DD converted to * t7 tell_command.alt = packet.z * 1.0e2f; tell_command.options = 1; // store altitude relative to home alt!! Always!!

so presume we now need to send two sets of positional data to the gcsmavlink, one lot with the waypoint for the copter, and another of the actual GCS position to film, plus an option to switch on the
MNT_GPSPOINT_OPTION == ENABLED

Hey, did you ever get anywhere further with this?

I’ve been pulling apart the source code too, and having a read over on the dev mailing list and it seems fairly quiet on the ROI front. I’m after a similar thing, we have waypoints being added dynamically based on a prediction model, and want to point a camera at a moving target. We can update the position of the target at a high enough frequency that ROI would do the job if we could get it working.

I’ll post back here if I get anywhere with it.

Please post to drones-discuss and make a pull request if you get this working