Hello every one,
Firstly sorry for my bad English skills.
I am working on Rover robot, using Nora AP,
I have used a set of unsupported sensors by Ardupilot (RPM, temp, battery voltage),Any way I get there values successfully by using another controller.
Now I want to send there values to GCS and display them on quick_tape of MP, by connect an UART port of controller to the AP UART.
I understand that I can do that by using Lua scripts, but I am beginner with Lua, and I want to know what is the function that should I used,
I read the Ardupilot document of Lua
and check the githup examples, but I cant understand how to do that,
can any one help me with any quick guide please or at least inform me what is the main functions that should be used.
I check the link and understand that I should use this function: gcs:send_named_float() to send the value of sensor to display it on quick tap in mission planner, but I still canât find out the right form of this function, Although I have read many examples.
I attach photo for the Lua code and the results in mission planner and the quick tape page.
can you guide me how change the value of battery_temp in the quick tape
Hello every one,
Hello Mr. @VRquaeler
I check the Status window, and I noted that the mission planner is responding to the Lua code, but the responsive variables are not the desired one, the responsive variables are:
Sorry Mr @Yuri_Rage
I try to change Lua code like this, but doesnât work:
MAV_battery_voltage2 = 30
gcs:send_named_float(âbattery_voltage2â,MAV_battery_voltage2) â send a values
I didnât understand what the problem in my Lua
Should I make change in Lua or Mission planner?
Kindly can you explain to me more
Hello dear @Yuri_Rage
I want to receive data from the controller that connected to Nora autopilot via UART to the telem2 port,
I am facing issue with configure the telem2 in Lua code, where no data received, is this is the right forma:
-- find the serial first
local port = serial:find_serial(0)
if not port or baud == 0 then
gcs:send_text(0, "No Scripting Serial Port")
return
end
-- begin the serial port
port:begin(9600)
port:set_flow_control(0)
-- the main update function that is used to read in data from serial port
function update()
gcs:send_text(0, "byte2")
if not port then
gcs:send_text(0, "no Scripting Serial Port")
return update, 300
end
local n_bytes = port:available()
gcs:send_text(0, tostring(n_bytes))
--gcs:send_text(0, n_bytes)
while n_bytes > 0 do
local byte = port:read()
gcs:send_text(0, "byte")
end
return update, 300
end
return update, 300
what the value should be used for telem2 in the serial:find_serial() function?
where I have already modified the parameters of telem2 in mission planner, I make the baud rate = 9600 and the serial2_option = 28 as recommended in ardupilot-lua document.
Sorry for bothering you again and thank you for your time.
I donât have time to type it all out right now, but your script is full of logic errors and comparisons of undeclared variables. Also, you probably want to run it faster than 3Hz.
Specifically, the baud variable in the first conditional statement is never assigned, and the while loop becomes infinite anytime serial data is available.