Supervision tools (#2350)

The improvements:
- it is easier to add new tools that will be immediately visible for the users
- you can hide tools that you don't use
- you can set different default using the control_panel file
- it is backward compatible so you you don't change your current control_panel you keep every like before
This commit is contained in:
Fabien-B
2018-11-29 09:23:48 +01:00
committed by Gautier Hattenberger
parent f264ef2bed
commit a1b8de2535
42 changed files with 174 additions and 73 deletions
+5 -73
View File
@@ -3,82 +3,14 @@
<control_panel name="paparazzi control panel">
<section name="programs">
<program name="Server" command="sw/ground_segment/tmtc/server"/>
<program name="Data Link" command="sw/ground_segment/tmtc/link">
<arg flag="-d" constant="/dev/ttyUSB0"/>
<!-- Examples of custom configuration. -->
<!--program name="Server" command="sw/ground_segment/tmtc/server">
<arg flag="-b" constant="192.168.1.255:2010"/>
</program>
<program name="Link Combiner" command="sw/ground_segment/python/redundant_link/link_combiner.py"/>
<program name="GCS" command="sw/ground_segment/cockpit/gcs">
<arg flag="-layout" constant="large_left_col.xml"/>
</program>
<program name="Flight Plan Editor" command="sw/ground_segment/cockpit/gcs">
<arg flag="-edit"/>
</program>
<program name="Messages" command="sw/ground_segment/tmtc/messages"/>
<program name="Messages (Python)" command="sw/ground_segment/python/messages_app/messagesapp.py"/>
<program name="Settings" command="sw/ground_segment/tmtc/settings">
<arg flag="-ac" constant="@AIRCRAFT"/>
</program>
<program name="Settings (Python)" command="sw/ground_segment/python/settings_app/settingsapp.py">
<arg flag="--ac_id" constant="@AC_ID"/>
</program>
<program name="GPSd position display" command="sw/ground_segment/tmtc/gpsd2ivy"/>
<program name="Log Plotter" command="sw/logalizer/logplotter"/>
<program name="Real-time Plotter" command="sw/logalizer/plotter"/>
<program name="Real-time Plotter (Python)" command="sw/ground_segment/python/real_time_plot/realtimeplotapp.py"/>
<program name="Log File Player" command="sw/logalizer/play"/>
<program name="Simulator" command="sw/simulator/pprzsim-launch">
<arg flag="-a" constant="@AIRCRAFT"/>
</program>
<program name="Video Synchronizer" command="sw/ground_segment/misc/video_synchronizer"/>
<program name="Joystick" command="sw/ground_segment/joystick/input2ivy">
<arg flag="-ac" constant="@AIRCRAFT"/>
<arg flag="xbox_gamepad.xml"/>
</program>
<program name="Environment Simulator" command="sw/simulator/gaia"/>
<program name="Http Server" command="$python">
<arg flag="-m" constant="SimpleHTTPServer"/>
<arg flag="8889"/>
</program>
<program name="Plot Meteo Profile" command="sw/logalizer/plotprofile"/>
<program name="Weather Station" command="sw/ground_segment/misc/davis2ivy">
<arg flag="-d" constant="/dev/ttyUSB1"/>
</program>
<program name="Attitude Visualizer" command="sw/tools/attitude_viz.py"/>
<program name="App Server" command="sw/ground_segment/tmtc/app_server"/>
<program name="NatNet" command="sw/ground_segment/misc/natnet2ivy"/>
<program name="NatNet3" command="sw/ground_segment/python/natnet3.x/natnet2ivy.py"/>
<program name="Ivy2Nmea" command="sw/ground_segment/tmtc/ivy2nmea">
<arg flag="--port" constant="/dev/ttyUSB1"/>
<arg flag="--id" constant="1"/>
</program>
<program name="BluegigaUsbDongleScanner" command="sw/tools/bluegiga_usb_dongle/bluegiga_usb_driver">
<arg flag="/dev/ttyACM2"/>
<arg flag="scan" />
</program>
<program name="BluegigaUsbDongle" command="sw/tools/bluegiga_usb_dongle/bluegiga_usb_driver">
<arg flag="/dev/ttyACM2"/>
<arg flag="00:07:00:2d:d6:bb" />
<arg flag="4242" />
<arg flag="4252" />
</program>
<program name="ADS-B Intruders receiver" command="sw/ground_segment/misc/sbs2ivy">
<arg flag="--ac" constant="@AC_ID"/>
</program>
<program name="OpenSky-Network Intruders" command="sw/ground_segment/python/opensky-network/opensky.py"/>
<program name="SVInfo" command="sw/ground_segment/python/svinfo/svinfo.py"/>
<program name="IridiumDialer" command="sw/tools/iridium/iridium_link.py"/>
<program name="PayloadForward" command="sw/ground_segment/python/payload_forward/payload.py"/>
<program name="Wind" command="sw/ground_segment/python/wind/wind.py"/>
<program name="EnergyManager" command="sw/ground_segment/python/energy_mon/energy_mon.py"/>
<program name="AeronauticalInfo" command="sw/ground_segment/python/atc/atc.py"/>
<program name="RtpViewer" command="sw/tools/rtp_viewer/rtp_viewer.py">
<arg flag="-p" constant="5000"/>
<arg flag="-s" constant="0.75"/>
<arg flag="-r" constant="3"/>
</program>
<program name="rtcm2ivy" command="sw/ground_segment/misc/rtcm2ivy"/>
<program name="Gazebo" command="sw/tools/gzclient_launcher.sh"/>
<arg flag="-osm"/>
</program-->
</section>
<section name="sessions">
+4
View File
@@ -0,0 +1,4 @@
<program command="sw/ground_segment/misc/sbs2ivy" name="ADS-B Intruders receiver">
<arg constant="@AC_ID" flag="--ac" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/atc/atc.py" name="AeronauticalInfo" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/tmtc/app_server" name="App Server" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/tools/attitude_viz.py" name="Attitude Visualizer" />
+9
View File
@@ -0,0 +1,9 @@
#Blacklisted tools
#Add the name of the tool as defined in its xml file to hide it in the "Tools" menu in the paparazi center.
#Lines starting with # are comments and will be ignored.
#
#Examples: (Uncomment to hide them in the paparazzi center)
#BluegigaUsbDongleScanner
#BluegigaUsbDongle
#IridiumDialer
+7
View File
@@ -0,0 +1,7 @@
<program command="sw/tools/bluegiga_usb_dongle/bluegiga_usb_driver" name="BluegigaUsbDongle">
<arg flag="/dev/ttyACM2" />
<arg flag="00:07:00:2d:d6:bb" />
<arg flag="4242" />
<arg flag="4252" />
</program>
+5
View File
@@ -0,0 +1,5 @@
<program command="sw/tools/bluegiga_usb_dongle/bluegiga_usb_driver" name="BluegigaUsbDongleScanner">
<arg flag="/dev/ttyACM2" />
<arg flag="scan" />
</program>
+4
View File
@@ -0,0 +1,4 @@
<program command="sw/ground_segment/tmtc/link" name="Data Link">
<arg constant="/dev/ttyUSB0" flag="-d" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/energy_mon/energy_mon.py" name="EnergyManager" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/simulator/gaia" name="Environment Simulator" />
+4
View File
@@ -0,0 +1,4 @@
<program command="sw/ground_segment/cockpit/gcs" name="Flight Plan Editor">
<arg flag="-edit" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/tools/gzclient_launcher.sh" name="Gazebo" />
+4
View File
@@ -0,0 +1,4 @@
<program command="sw/ground_segment/cockpit/gcs" name="GCS">
<arg constant="large_left_col.xml" flag="-layout" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/tmtc/gpsd2ivy" name="GPSd position display" />
+5
View File
@@ -0,0 +1,5 @@
<program command="$python" name="Http Server">
<arg constant="SimpleHTTPServer" flag="-m" />
<arg flag="8889" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/tools/iridium/iridium_link.py" name="IridiumDialer" />
+5
View File
@@ -0,0 +1,5 @@
<program command="sw/ground_segment/tmtc/ivy2nmea" name="Ivy2Nmea">
<arg constant="/dev/ttyUSB1" flag="--port" />
<arg constant="1" flag="--id" />
</program>
+5
View File
@@ -0,0 +1,5 @@
<program command="sw/ground_segment/joystick/input2ivy" name="Joystick">
<arg constant="@AIRCRAFT" flag="-ac" />
<arg flag="xbox_gamepad.xml" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/redundant_link/link_combiner.py" name="Link Combiner" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/logalizer/play" name="Log File Player" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/logalizer/logplotter" name="Log Plotter" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/tmtc/messages" name="Messages" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/messages_app/messagesapp.py" name="Messages (Python)" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/misc/natnet2ivy" name="NatNet" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/natnet3.x/natnet2ivy.py" name="NatNet3" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/opensky-network/opensky.py" name="OpenSky-Network Intruders" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/payload_forward/payload.py" name="PayloadForward" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/logalizer/plotprofile" name="Plot Meteo Profile" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/logalizer/plotter" name="Real-time Plotter" />
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/real_time_plot/realtimeplotapp.py" name="Real-time Plotter (Python)" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/misc/rtcm2ivy" name="rtcm2ivy" />
+6
View File
@@ -0,0 +1,6 @@
<program command="sw/tools/rtp_viewer/rtp_viewer.py" name="RtpViewer">
<arg constant="5000" flag="-p" />
<arg constant="0.75" flag="-s" />
<arg constant="3" flag="-r" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/tmtc/server" name="Server" />
+4
View File
@@ -0,0 +1,4 @@
<program command="sw/ground_segment/tmtc/settings" name="Settings">
<arg constant="@AIRCRAFT" flag="-ac" />
</program>
+4
View File
@@ -0,0 +1,4 @@
<program command="sw/ground_segment/python/settings_app/settingsapp.py" name="Settings (Python)">
<arg constant="@AC_ID" flag="--ac_id" />
</program>
+4
View File
@@ -0,0 +1,4 @@
<program command="sw/simulator/pprzsim-launch" name="Simulator">
<arg constant="@AIRCRAFT" flag="-a" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/svinfo/svinfo.py" name="SVInfo" />
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/misc/video_synchronizer" name="Video Synchronizer" />
+4
View File
@@ -0,0 +1,4 @@
<program command="sw/ground_segment/misc/davis2ivy" name="Weather Station">
<arg constant="/dev/ttyUSB1" flag="-d" />
</program>
+2
View File
@@ -0,0 +1,2 @@
<program command="sw/ground_segment/python/wind/wind.py" name="Wind" />
+45
View File
@@ -28,14 +28,59 @@ module Utils = Pc_common
let (//) = Filename.concat
(*Search recursively files in a directory*)
let walk_directory_tree dir pattern =
let re = Str.regexp pattern in (* pre-compile the regexp *)
let select str = Str.string_match re str 0 in
let rec walk acc = function
| [] -> (acc)
| dir::tail ->
let contents = Array.to_list (Sys.readdir dir) in
let contents = List.rev_map (Filename.concat dir) contents in
let dirs, files =
List.fold_left (fun (dirs,files) f ->
match (Unix.stat f).Unix.st_kind with
| Unix.S_REG -> (dirs, f::files) (* Regular file *)
| Unix.S_DIR -> (f::dirs, files) (* Directory *)
| _ -> (dirs, files)
) ([],[]) contents
in
let matched = List.filter (select) files in
walk (matched @ acc) (dirs @ tail)
in
walk [] [dir]
let control_panel_xml_file = Utils.conf_dir // "control_panel.xml"
let control_panel_xml = ExtXml.parse_file control_panel_xml_file
let tools_directory = (Utils.conf_dir // "tools")
let tool_files = if (Sys.file_exists tools_directory) then (walk_directory_tree tools_directory ".*\\.xml") else []
let tools_xml = List.map (fun f -> ExtXml.parse_file f) tool_files
let blacklist_file = tools_directory // "blacklisted"
let rec build_list l channel =
try
build_list ((input_line channel) :: l) channel
with End_of_file -> close_in channel; List.rev l
let programs =
let h = Hashtbl.create 7 in
let s = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = "programs") control_panel_xml "section" in
(*List blacklisted programs*)
let b = if Sys.file_exists blacklist_file
then (List.filter (fun s -> ((String.length s) > 0 && (String.get s 0) != '#')) (build_list [] (open_in blacklist_file)))
else [] in
(*Adds tools to h*)
List.iter
(fun p -> Hashtbl.add h (ExtXml.attrib p "name") p)
tools_xml;
(*Overwrite tools in h by the custom configuration from control_panel.xml*)
List.iter
(fun p -> Hashtbl.replace h (ExtXml.attrib p "name") p)
(Xml.children s);
(*Remove blacklisted programs*)
List.iter
(fun p -> Hashtbl.remove h p)
b;
h
let program_command = fun x ->