bugobliterator
4 years ago
committed by
Andrew Tridgell
4 changed files with 64 additions and 2 deletions
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
|
||||
local counter = 0 |
||||
local running = 0 |
||||
local last_pan_cmd = 0.0 |
||||
local last_tilt_cmd = 0.0 |
||||
|
||||
function update() |
||||
if onvif and onvif.start and counter >= 100 and running == 0 then |
||||
gcs:send_text(0, "onvif starting") |
||||
if onvif:start("user","123456","http://10.211.55.3:10000") then |
||||
gcs:send_text(0, "onvif started") |
||||
running = 1 |
||||
end |
||||
counter = 0 |
||||
end |
||||
counter = counter + 1 |
||||
|
||||
if running == 1 then |
||||
pan_norm, tilt_norm = vehicle:get_pan_tilt_norm() |
||||
pan_tilt_limit_max = onvif:get_pan_tilt_limit_max() |
||||
pan_tilt_limit_min = onvif:get_pan_tilt_limit_min() |
||||
pan_norm = ((pan_norm + 1) * (pan_tilt_limit_max:x() - pan_tilt_limit_min:x())/2.0) + pan_tilt_limit_min:x() |
||||
tilt_norm = ((tilt_norm + 1) * (pan_tilt_limit_max:y() - pan_tilt_limit_min:y())/2.0) + pan_tilt_limit_min:y() |
||||
gcs:send_text(0, string.format("PAN: %f TILT: %f", pan_norm, tilt_norm)) |
||||
if math.floor(pan_norm*100.0) ~= math.floor(last_pan_cmd*100.0) or |
||||
math.floor(tilt_norm*100.0) ~= math.floor(last_tilt_cmd*100.0) then |
||||
-- actually send the command |
||||
if not onvif:set_absolutemove(pan_norm, tilt_norm, 0.0) then |
||||
gcs:send_text(0, "onvif failed to send absolutemove command") |
||||
end |
||||
last_pan_cmd = pan_norm; |
||||
last_tilt_cmd = tilt_norm; |
||||
end |
||||
end |
||||
return update, 20 |
||||
end |
||||
gcs:send_text(0, "Starting ONVIF Control") |
||||
|
||||
return update() -- run immediately before starting to reschedule |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
# ONVIF_Camera_Control Lua Script |
||||
|
||||
This is a script that converts AntennaTracker into a Drone Tracking Camera using ONVIF capable Camera. The Camera needs to support PTZ AbsoluteMove method. The camera is sent absolute Pan Tilt commands based on requirement from Antenna Tracker lib. |
||||
|
||||
User just needs to edit the script to set string username, password and IP address:port of the camera. Currently we only support running as part of SITL/Linux instance. Which can simply be done by adding `--enable-onvif` the rest including adding this script will be taken care of by build system. Also you will need to set `PITCH_MAX` `PITCH_MIN` and `YAW_RANGE` parameters per camera specifications. |
||||
|
||||
Following steps are required before doing ONVIF build: |
||||
``` |
||||
cd modules/gsoap |
||||
autoreconf -f -i |
||||
./configure |
||||
make |
||||
make install #add sudo if needed |
||||
``` |
Loading…
Reference in new issue