diff --git a/ground/pyuavtalk/examples/example.py b/ground/pyuavtalk/examples/example.py index 344525c479a..9df03f94705 100644 --- a/ground/pyuavtalk/examples/example.py +++ b/ground/pyuavtalk/examples/example.py @@ -69,19 +69,19 @@ def setup(self, port): print "Starting UavTalk" self.uavTalk.start() - print "Starting ConnectionManager" - self.connMan = ConnectionManager(self.uavTalk, self.objMan) + #print "Starting ConnectionManager" + #self.connMan = ConnectionManager(self.uavTalk, self.objMan) - print "Connecting...", - self.connMan.connect() - print "Connected" + #print "Connecting...", + #self.connMan.connect() + #print "Connected" - print "Getting all Data" - self.objMan.requestAllObjUpdate() + #print "Getting all Data" + #self.objMan.requestAllObjUpdate() - print "SN:", - sn = self.objMan.FirmwareIAPObj.CPUSerial.value - print "".join(map(_hex02, sn)) + #print "SN:", + #sn = self.objMan.FirmwareIAPObj.CPUSerial.value + #print "".join(map(_hex02, sn)) def stop(self): if self.uavTalk: @@ -89,31 +89,31 @@ def stop(self): self.uavTalk.stop() def showAttitudeViaObserver(self): - print "Request fast periodic updates for AttitudeActual" - self.objMan.AttitudeActual.metadata.telemetryUpdateMode.value = UAVMetaDataObject.UpdateMode.PERIODIC - self.objMan.AttitudeActual.metadata.telemetryUpdatePeriod.value = 50 - self.objMan.AttitudeActual.metadata.updated() + print "Request fast periodic updates for AttitudeState" + self.objMan.AttitudeState.metadata.telemetryUpdateMode.value = UAVMetaDataObject.UpdateMode.PERIODIC + self.objMan.AttitudeState.metadata.telemetryUpdatePeriod.value = 50 + self.objMan.AttitudeState.metadata.updated() - print "Install Observer for AttitudeActual updates\n" - self.objMan.regObjectObserver(self.objMan.AttitudeActual, self, "_onAttitudeUpdate") + print "Install Observer for AttitudeState updates\n" + self.objMan.regObjectObserver(self.objMan.AttitudeState, self, "_onAttitudeUpdate") # Spin until we get interrupted while True: time.sleep(1) def showAttitudeViaWait(self): - print "Request fast periodic updates for AttitudeActual" - self.objMan.AttitudeActual.metadata.telemetryUpdateMode.value = UAVMetaDataObject.UpdateMode.PERIODIC - self.objMan.AttitudeActual.metadata.telemetryUpdatePeriod.value = 50 - self.objMan.AttitudeActual.metadata.updated() + print "Request fast periodic updates for AttitudeState" + self.objMan.AttitudeState.metadata.telemetryUpdateMode.value = UAVMetaDataObject.UpdateMode.PERIODIC + self.objMan.AttitudeState.metadata.telemetryUpdatePeriod.value = 50 + self.objMan.AttitudeState.metadata.updated() while True: - self.objMan.AttitudeActual.waitUpdate() - self._onAttitudeUpdate(self.objMan.AttitudeActual) + self.objMan.AttitudeState.waitUpdate() + self._onAttitudeUpdate(self.objMan.AttitudeState) def showAttitudeViaGet(self): while True: - self.objMan.AttitudeActual.getUpdate() - self._onAttitudeUpdate(self.objMan.AttitudeActual) + self.objMan.AttitudeState.getUpdate() + self._onAttitudeUpdate(self.objMan.AttitudeState) def _onAttitudeUpdate(self, args): self.nbUpdates += 1 @@ -131,8 +131,10 @@ def _onAttitudeUpdate(self, args): print " %s Rate: %02.1f Hz " % (dot, self.updateRate), - roll = self.objMan.AttitudeActual.Roll.value - print "Roll: %-4d " % roll, + roll = self.objMan.AttitudeState.Roll.value + print "RPY: %f %f %f " % (self.objMan.AttitudeState.Roll.value,self.objMan.AttitudeState.Pitch.value,self.objMan.AttitudeState.Yaw.value)+" \r", + return + print "Roll: %f " % roll, i = roll/90 if i<-1: i=-1 if i>1: i= 1 diff --git a/ground/pyuavtalk/openpilot/uavtalk/objectManager.py b/ground/pyuavtalk/openpilot/uavtalk/objectManager.py index 0849c57ce0c..0065d0674b9 100644 --- a/ground/pyuavtalk/openpilot/uavtalk/objectManager.py +++ b/ground/pyuavtalk/openpilot/uavtalk/objectManager.py @@ -130,9 +130,12 @@ def requestAllObjUpdate(self): #print "GetMeta %s" % obj try: logging.debug("Getting %s" % obj) + print("Getting %s" % obj) self.waitObjUpdate(obj, request=True, timeout=.1) logging.debug(" Getting %s" % obj.metadata) + print(" Getting %s" % obj.metadata) self.waitObjUpdate(obj.metadata, request=True, timeout=.1) + print(" Done Getting %s" % obj.metadata) except TimeoutException: logging.debug(" TIMEOUT") pass diff --git a/ground/pyuavtalk/openpilot/uavtalk/uavtalk.py b/ground/pyuavtalk/openpilot/uavtalk/uavtalk.py index 9465589c0aa..64dba548bd8 100644 --- a/ground/pyuavtalk/openpilot/uavtalk/uavtalk.py +++ b/ground/pyuavtalk/openpilot/uavtalk/uavtalk.py @@ -201,7 +201,7 @@ def _consumeByte(self, rx): logging.error("packet Size MISMATCH") self.rxState = UavTalkRecThread.STATE_SYNC else: - print "Object: %s" % self.obj + # print "Object: %s" % self.obj self.rxCount = 0 self.rxData = []