Hello everyone! I’ve been wanting to make an AntennaTracker recently, but unlike the usual AAT, I hope my AAT can be mounted on a drone.
My current idea is to read the position data of the target drone from the serial port input through a lua script, and use the mount:set_roi_target function to aim my gimbal at the target drone.
However, the size of my AAT drone is limited, so my antenna may not have control in the YAW direction. In other words, I need the YAW of my AAT drone to become the YAW of the AAT.
I have thought of a method, which is to continuously write the DO_SET_ROI waypoint command using a LUA script. But I’m worried that if I update the mission at a frequency of 5-10hz, will it cause other problems? Such as flash life and so on.
My flight may last up to an hour, even if I update the mission at a frequency of 1Hz, I think the flash of my FC may soon have problems.
Do I have other solutions? For example, using LUA+GUIDED (I haven’t found an implementation case)? Or other ways to move the YAW of the drone while ensuring the position control remains unchanged by the lua script?
Do what @khancyr recommended you. Use a Blimp vehicle type. It does all you need automatically, you just need to set the DO_SET_ROI waypoint coordinates and it will calculate the correct YAW on the fly.
@amilcarlucas not a duplicate that another guy and question
@Ben_bili,you got the right approach. But you don’t need to write a new mission to update the mount yaw. There is a mavlink message for this that give you direct control. So from Lua, you should be able to adjust the mount targeting and input some yaw correction.
@khancyr Thank you very much! I’ve always overlooked the fact that there’s a function in the Lua API for sending MAVLink messages, because I saw in another discussion that Lua scripts can’t directly output MAVLink commands to the flight controller.
So, does this mean that I need to put my AAT drone in GUIDED MODE, then enable the Lua script to read the target drone’s position from the serial input at a frequency of 5-10Hz, and send the MAV_CMD_DO_SET_ROI_LOCATION message? I think this shouldn’t cause any issues with my flight controller’s flash memory, right?
For the Lua code mavlink:send(0, mavlink_msgs.encode("MAV_CMD_DO_SET_ROI_LOCATION", { param1 = 0, param5 = 467520190, param6 = 1067520190, param7 = 1000,})), could you tell me if there’s anything wrong? I’m assuming the ROI is at a certain location at an altitude of 1000m.