How to use the cflib.crtp.crtpstack.CRTPPort function in cflib

To help you get started, we’ve selected a few cflib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcraze / crazyflie-clients-python / lib / cflib / crazyflie / commander.py View on Github external
def send_setpoint(self, roll, pitch, yaw, thrust):
        """
        Send a new control setpoint for roll/pitch/yaw/thust to the copter

        The arguments roll/pitch/yaw/trust is the new setpoints that should
        be sent to the copter
        """
        if self._x_mode:
            roll = 0.707*(roll-pitch)
            pitch = 0.707*(roll+pitch)

        pk = CRTPPacket()
        pk.port = CRTPPort.COMMANDER
        pk.data = struct.pack('
github bitcraze / crazyflie-clients-python / src / cflib / cflib / crazyflie / log.py View on Github external
def refresh_toc(self, refresh_done_callback, toc_cache):
        """Start refreshing the table of loggale variables"""

        self._toc_cache = toc_cache
        self._refresh_callback = refresh_done_callback
        self.toc = None

        pk = CRTPPacket()
        pk.set_header(CRTPPort.LOGGING, CHAN_SETTINGS)
        pk.data = (CMD_RESET_LOGGING,)
        self.cf.send_packet(pk, expected_reply=(CMD_RESET_LOGGING,))
github bitcraze / crazyflie-clients-python / src / cflib / cflib / crazyflie / commander.py View on Github external
def send_setpoint(self, roll, pitch, yaw, thrust):
        """
        Send a new control setpoint for roll/pitch/yaw/thrust to the copter

        The arguments roll/pitch/yaw/trust is the new setpoints that should
        be sent to the copter
        """
        if thrust > 0xFFFF or thrust < 0:
            raise ValueError("Thrust must be between 0 and 0xFFFF")

        if self._x_mode:
            roll, pitch = 0.707 * (roll - pitch), 0.707 * (roll + pitch)

        pk = CRTPPacket()
        pk.port = CRTPPort.COMMANDER
        pk.data = struct.pack('
github bitcraze / crazyflie-clients-python / src / cfclient / ui / toolboxes / DebugDriverToolbox.py View on Github external
def linkQualityChanged(self, value):
        if (self.helper.cf.link is not None):
            p = CRTPPacket()
            p.set_header(CRTPPort.DEBUGDRIVER, 0)
            p.data = struct.pack('
github bitcraze / crazyflie-clients-python / src / cflib / cflib / crazyflie / log.py View on Github external
def __init__(self, crazyflie=None):
        self.log_blocks = []
        # Called with newly created blocks
        self.block_added_cb = Caller()

        self.cf = crazyflie
        self.toc = None
        self.cf.add_port_callback(CRTPPort.LOGGING, self._new_packet_cb)

        self.toc_updated = Caller()
        self.state = IDLE
        self.fake_toc_crc = 0xDEADBEEF

        self._refresh_callback = None
        self._toc_cache = None
github bitcraze / crazyflie-clients-python / src / cflib / cflib / crazyflie / console.py View on Github external
def __init__(self, crazyflie):
        """
        Initialize the console and register it to receive data from the copter.
        """
        self.cf = crazyflie
        self.cf.add_port_callback(CRTPPort.CONSOLE, self.incoming)