Good Morning,
I am trying to run a mission as to where I can flip a relay switch every 50 feet during my mission. I have a couple things that I would like to get done as a result of this. First, I would like to send a signal to an arduino board which will then perform some external coding that I have put on the board. Secondly, I would like pixhawk to report back the GPS coordinates every time that this relay signal is sent out. My questions are as follows:
Is there a relay command that will cause the relay function to be set every 50 feet like there is on DO_SET_CAM_DIST?
Is there possibly a way to see this information on the TLOGS after the flight has completed?
Does anyone have any reccomendations on a way that I can succesfully implement this idea in the simplest way possible.
I am using a pixhawk orange cube with Rover 4.1 installed on the cube itself with a Here3+ GPS module. Thank you again for all of your help everyone!
I have never tried to write a lua script before. Do you have any advice on where to start doing research or finding examples of some lua scripts? Thank you
For GPS location information, here’s a short code snippet:
local instance = gps:primary_sensor()
local position = gps:location(instance)
local latitude = position:lat()
local longitude = position:lng()
local altitude = position:alt()
The location object also includes a handy get_distance() method that will return distance between itself and another location object (in meters). I’ve used it for distance based triggering similar to what you describe.