1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

LP-564 Python script : Handle Thrust value and Connected state for safety reasons

This commit is contained in:
Laurent Lalanne 2017-12-09 21:50:04 +01:00
parent 7ae7a7b3db
commit f8d32a35e6

View File

@ -163,6 +163,8 @@ class UavtalkDemo():
print "Taking control of self.ManualControl" print "Taking control of self.ManualControl"
self.objMan.ManualControlCommand.metadata.access = UAVMetaDataObject.Access.READONLY self.objMan.ManualControlCommand.metadata.access = UAVMetaDataObject.Access.READONLY
self.objMan.ManualControlCommand.metadata.updated() self.objMan.ManualControlCommand.metadata.updated()
self.objMan.ManualControlCommand.Connected.value = True
self.objMan.ManualControlCommand.updated()
print "Arming board using Yaw right" print "Arming board using Yaw right"
while (self.objMan.FlightStatus.Armed.value != 2): while (self.objMan.FlightStatus.Armed.value != 2):
@ -179,6 +181,11 @@ class UavtalkDemo():
print "Applying Throttle" print "Applying Throttle"
self.objMan.ManualControlCommand.Throttle.value = 0.01 # very small value for safety self.objMan.ManualControlCommand.Throttle.value = 0.01 # very small value for safety
# Assuming board do not control a helicopter, Thrust value will be equal to Throttle value.
# Because a 'high' value can be read from latest real RC input value,
# initial value is set now to zero for safety reasons.
self.objMan.ManualControlCommand.Thrust.value = 0
# self.objMan.ManualControlCommand.Throttle.value = self.objMan.ManualControlCommand.Thrust.value
self.objMan.ManualControlCommand.updated() self.objMan.ManualControlCommand.updated()
time.sleep(0.3) time.sleep(0.3)
@ -235,6 +242,8 @@ class UavtalkDemo():
print "Back to self.ManualControl, controlled by RC radio" print "Back to self.ManualControl, controlled by RC radio"
self.objMan.ManualControlCommand.metadata.access = UAVMetaDataObject.Access.READWRITE self.objMan.ManualControlCommand.metadata.access = UAVMetaDataObject.Access.READWRITE
self.objMan.ManualControlCommand.metadata.updated() self.objMan.ManualControlCommand.metadata.updated()
self.objMan.ManualControlCommand.Connected.value = False
self.objMan.ManualControlCommand.updated()
def printUsage(): def printUsage():