Polygon Fences through mavros package

Hello everyone, I have this configuration:

  • Pixracer R15
  • Arducopter 4.2.3
  • ROS noetic with mavros package and mocap_optitrack installed

I am able to fly the drone using Optitrack Motion Capture system, ROS installed and the software Motive to create rigid bodies associated with real markers.

Now I would like to create a rectangular fence using Optitrack positions as limits, one for each
side of the polygon. Let’s say 4 for semplicity.

I want to control the drone using my transmitter with its RC channels,
but in this fence and in the case of breaching the limits I want to switch to Loiter Mode.

I read about polygon fences and I saw that this can be made using
Ground Control Stations such as MissionPlanner and QGroundControl.

I want to do that using ROS and the package mavros!

Do you know how can I do that?

Do i need to use the topic /mavros/geofence/waypoints?

Is there any mavros service like mavwp to load waypoints but for polygon fences?

Is there any mavros plugin needed to include in the whitelist that is in apm_pluginlists.yaml (mavros package)?

Thank you in advance.