Merge remote-tracking branch 'paparazzi/master' into pprzlink

fix conflicts and update bluegiga datalink event
This commit is contained in:
Gautier Hattenberger
2016-01-14 14:32:06 +01:00
65 changed files with 1455 additions and 656 deletions
File diff suppressed because it is too large Load Diff
+15 -12
View File
@@ -118,16 +118,19 @@ class Guidance(object):
if __name__ == '__main__':
ac_id = 30
g = Guidance(ac_id)
sleep(0.1)
g.set_guided_mode()
sleep(0.2)
g.goto_ned(north=10.0, east=5.0, down=-5.0, heading=radians(90))
sleep(10)
g.goto_ned_relative(north=-5.0, east=-5.0, down=-2.0, yaw=-radians(45))
sleep(10)
g.goto_body_relative(forward=0.0, right=5.0, down=2.0)
sleep(10)
g.set_nav_mode()
sleep(0.2)
try:
g = Guidance(ac_id)
sleep(0.1)
g.set_guided_mode()
sleep(0.2)
g.goto_ned(north=10.0, east=5.0, down=-5.0, heading=radians(90))
sleep(10)
g.goto_ned_relative(north=-5.0, east=-5.0, down=-2.0, yaw=-radians(45))
sleep(10)
g.goto_body_relative(forward=0.0, right=5.0, down=2.0)
sleep(10)
g.set_nav_mode()
sleep(0.2)
except KeyboardInterrupt:
print("Stopping on request")
g.shutdown()
@@ -4,6 +4,7 @@ from __future__ import print_function
import sys
from os import path, getenv
from time import sleep
# if PAPARAZZI_SRC not set, then assume the tree containing this
# file is a reasonable substitute
@@ -13,6 +14,7 @@ sys.path.append(PPRZ_SRC + "/sw/lib/python")
from ivy_msg_interface import IvyMessagesInterface
from pprz_msg.message import PprzMessage
class WaypointMover(object):
def __init__(self, verbose=False):
self.verbose = verbose
@@ -41,6 +43,12 @@ class WaypointMover(object):
if __name__ == '__main__':
wm = WaypointMover()
wm.move_waypoint(ac_id=202, wp_id=3, lat=43.563, lon=1.481, alt=172.0)
try:
wm = WaypointMover()
# sleep shortly in oder to make sure Ivy is up, then message sent before shutting down again
sleep(0.1)
wm.move_waypoint(ac_id=202, wp_id=3, lat=43.563, lon=1.481, alt=172.0)
sleep(0.1)
except KeyboardInterrupt:
print("Stopping on request")
wm.shutdown()
@@ -21,7 +21,7 @@ from pprz_msg import messages_xml_map
class PlotData:
def __init__(self, ivy_msg_id, title, width, color=None):
def __init__(self, ivy_msg_id, title, width, color=None, scale=1.0):
self.id = ivy_msg_id
self.title = title
self.SetPlotSize(width)
@@ -32,14 +32,14 @@ class PlotData:
self.std_dev = 0.0
self.real_time = False
self.scale = 1.0
self.scale = scale
self.offset = 0.0
if color is not None:
self.color = color
else:
r, g, b = random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)
self.color = wx.Color(r, g, b)
self.color = wx.Colour(r, g, b)
def SetRealTime(self, value):
self.real_time = value
@@ -176,7 +176,7 @@ class PlotPanel(object):
self.width = 800
self.height = 200
self.margin = min(self.height / 10, 20)
self.font = wx.Font(self.margin / 2, wx.DEFAULT, wx.FONTFLAG_DEFAULT, wx.FONTWEIGHT_NORMAL)
self.font = wx.Font(self.margin / 2, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.pixmap = wx.EmptyBitmap(self.width, self.height)
self.plot_size = self.width
self.max = -1e32
@@ -253,7 +253,7 @@ class PlotPanel(object):
def OnDropText(self, data):
[ac_id, category, message, field, scale] = data.encode('ASCII').split(':')
self.BindCurve(int(ac_id), message, field)
self.BindCurve(int(ac_id), message, field, scale=float(scale))
def OnIvyMsg(self, agent, *larg):
# print(larg[0])
@@ -282,7 +282,7 @@ class PlotPanel(object):
plot.index = self.x_axis.index
plot.AddPoint(point, self.x_axis)
def BindCurve(self, ac_id, message, field, color=None, use_as_x=False):
def BindCurve(self, ac_id, message, field, color=None, use_as_x=False, scale=1.0):
# -- add this telemetry to our list of things to plot ...
message_string = _IVY_STRING % (ac_id, message)
# print('Binding to %s' % message_string)
@@ -300,7 +300,7 @@ class PlotPanel(object):
ivy_id = IvyBindMsg(self.OnIvyMsg, str(message_string))
title = '%i:%s:%s' % (ac_id, message, field)
self.plots[ac_id][message][field] = PlotData(ivy_id, title, self.plot_size, color)
self.plots[ac_id][message][field] = PlotData(ivy_id, title, self.plot_size, color, scale)
self.frame.AddCurve(ivy_id, title, use_as_x)
if use_as_x:
self.x_axis = self.plots[ac_id][message][field]
@@ -384,7 +384,7 @@ class PlotPanel(object):
self.height = height
self.plot_size = width
self.margin = min(self.height / 10, 20)
self.font = wx.Font(self.margin / 2, wx.DEFAULT, wx.FONTFLAG_DEFAULT, wx.FONTWEIGHT_NORMAL)
self.font = wx.Font(self.margin / 2, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
def OnTimer(self):
self.timer.Restart(self.plot_interval)
+3 -5
View File
@@ -41,7 +41,7 @@ module Tm_Pprz = PprzLink.Messages (struct let name = "telemetry" end)
module Alerts_Pprz = PprzLink.Messages(struct let name = "alert" end)
module Dl_Pprz = PprzLink.Messages (struct let name = "datalink" end)
let dl_id = "ground_dl" (* Hack, should be [my_id] *)
let (//) = Filename.concat
let logs_path = Env.paparazzi_home // "var" // "logs"
@@ -373,7 +373,7 @@ let send_aircraft_msg = fun ac ->
"speed", cm_of_m a.gspeed;
"climb", cm_of_m a.climb;
"itow", PprzLink.Int64 a.itow] in
Dl_Pprz.message_send my_id "ACINFO" ac_info;
Dl_Pprz.message_send dl_id "ACINFO" ac_info;
end;
if !Kml.enabled then
@@ -649,7 +649,7 @@ let send_intruder_acinfo = fun id intruder ->
"speed", cm_of_m intruder.Intruder.gspeed;
"climb", cm_of_m intruder.Intruder.climb;
"itow", PprzLink.Int64 intruder.Intruder.itow] in
Dl_Pprz.message_send my_id "ACINFO" ac_info
Dl_Pprz.message_send dl_id "ACINFO" ac_info
let periodic_handle_intruders = fun () ->
(* remove old intruders after 10s *)
@@ -737,8 +737,6 @@ let cm_of_m = fun f -> PprzLink.Int (truncate ((100. *. f) +. 0.5))
(** Convert to mm, with rounding *)
let mm_of_m_32 = fun f -> PprzLink.Int32 (Int32.of_int (truncate ((1000. *. f) +. 0.5)))
let dl_id = "ground_dl" (* Hack, should be [my_id] *)
(** Got a ground.MOVE_WAYPOINT and send a datalink.MOVE_WP *)
let move_wp = fun logging _sender vs ->
let f = fun a -> List.assoc a vs