Create the objects from this module and register callbacks. ro_cache -- Path to read-only cache (string) rw_cache -- Path to read-write cache (string)
(self, link=None, ro_cache=None, rw_cache=None)
| 72 | """The Crazyflie class""" |
| 73 | |
| 74 | def __init__(self, link=None, ro_cache=None, rw_cache=None): |
| 75 | """ |
| 76 | Create the objects from this module and register callbacks. |
| 77 | |
| 78 | ro_cache -- Path to read-only cache (string) |
| 79 | rw_cache -- Path to read-write cache (string) |
| 80 | """ |
| 81 | |
| 82 | # Called on disconnect, no matter the reason |
| 83 | self.disconnected = Caller() |
| 84 | # Called on unintentional disconnect only |
| 85 | self.connection_lost = Caller() |
| 86 | # Called when the first packet in a new link is received |
| 87 | self.link_established = Caller() |
| 88 | # Called when the user requests a connection |
| 89 | self.connection_requested = Caller() |
| 90 | # Called when the link is established and the TOCs (that are not |
| 91 | # cached) have been downloaded |
| 92 | self.connected = Caller() |
| 93 | # Called if establishing of the link fails (i.e times out) |
| 94 | self.connection_failed = Caller() |
| 95 | # Called for every packet received |
| 96 | self.packet_received = Caller() |
| 97 | # Called for every packet sent |
| 98 | self.packet_sent = Caller() |
| 99 | # Called when the link driver updates the link quality measurement |
| 100 | self.link_quality_updated = Caller() |
| 101 | |
| 102 | self.state = State.DISCONNECTED |
| 103 | |
| 104 | self.link = link |
| 105 | self._toc_cache = TocCache(ro_cache=ro_cache, |
| 106 | rw_cache=rw_cache) |
| 107 | |
| 108 | self.incoming = _IncomingPacketHandler(self) |
| 109 | self.incoming.setDaemon(True) |
| 110 | if self.link: |
| 111 | self.incoming.start() |
| 112 | |
| 113 | self.commander = Commander(self) |
| 114 | self.high_level_commander = HighLevelCommander(self) |
| 115 | self.loc = Localization(self) |
| 116 | self.extpos = Extpos(self) |
| 117 | self.log = Log(self) |
| 118 | self.console = Console(self) |
| 119 | self.param = Param(self) |
| 120 | self.mem = Memory(self) |
| 121 | self.platform = PlatformService(self) |
| 122 | self.appchannel = Appchannel(self) |
| 123 | |
| 124 | self.link_uri = '' |
| 125 | |
| 126 | # Used for retry when no reply was sent back |
| 127 | self.packet_received.add_callback(self._check_for_initial_packet_cb) |
| 128 | self.packet_received.add_callback(self._check_for_answers) |
| 129 | |
| 130 | self._answer_patterns = {} |
| 131 |
no test coverage detected