Multiple ROI's in flightplan (MAVLink)

Has anybody managed to create flightplans with multiple regions of interest, that change, depending on the current location of the drone (e.g. when waypoints were reached)?
Im trying to, always face towards the next waypoint or in other words, watch to the direction im heading to.

Thanks in advance

Edit.

I added ROI’s with parameters MAV_ROI_LOCATION, an roi id and the desired latitude and longitude before every waypoint i add to the flightplan.
Doesn’t that mean, the drone will re-orientate itself after having reached those waypoints? Cause it doesnt as of now.

And i didnt make use of CreateMavlinkSetViewMode yet, is it needed to make the drone, point towards my roi?

As i’m writing, what’ the meaning of the yaw parameter of CreateMavlinkNavWaypointMissionItem… does this maybe mess things up?

Any help would be appreciated.

Also Trying to Do EXACTLY this. Any help would be much appreciated. Did you figure out a solution @str333t

Do you mean something like this?

Define all of your ROIs up front, like so:

// initial pass to build POIs - bypass if evinrude
if (!evinrude) {
    for (MavlinkMarker marker : xxx.mavlinkMarkers.getPois()) {
        final ARMavlinkMissionItem roi = ARMavlinkMissionItem.CreateMavlinkSetROI(MAV_ROI.MAV_ROI_LOCATION, 0, marker.getId(), (float) marker.getLatitude(), (float) marker.getLongitude(), (float) marker.getAltitude());
        generator.addMissionItem(roi);
    }
}

For a waypoint you want to associate with a specific ROI you must set the the appropriate VIEW_MODE before you generate the waypoint, like so:

final ARMavlinkMissionItem view = ARMavlinkMissionItem.CreateMavlinkSetViewMode(MAV_VIEW_MODE_TYPE.VIEW_MODE_TYPE_ROI, mark.getPoi().getId());
generator.addMissionItem(view);

Otherwise, define your VIEW_MODE as progressive (CONTINUE) or fixed (ABSOLUTE) — this is where you can leverage the YAW parameter in your waypoint.

// progressive
final ARMavlinkMissionItem view = ARMavlinkMissionItem.CreateMavlinkSetViewMode(MAV_VIEW_MODE_TYPE.VIEW_MODE_TYPE_CONTINUE, -1);
generator.addMissionItem(view);

or

// absolute
final ARMavlinkMissionItem view = ARMavlinkMissionItem.CreateMavlinkSetViewMode(MAV_VIEW_MODE_TYPE.VIEW_MODE_TYPE_ABSOLUTE, -1);
generator.addMissionItem(view);

And then you can generate your actual waypoint:

final ARMavlinkMissionItem destination = ARMavlinkMissionItem.CreateMavlinkNavWaypointMissionItem((float) start.latitude, (float) start.longitude, (float) startAltitude, (float) yaw, 0);
generator.addMissionItem(destination);

Lastly, do not generate frivolous / duplicate VIEW MODE commands.