User Tools

Site Tools


projects:crazyflie:crtp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:crazyflie:crtp [2013-02-22 07:07]
macke
projects:crazyflie:crtp [2017-04-01 21:29] (current)
theseankelly [Port allocation]
Line 22: Line 22:
 CRTP is implemented in 3 layers: CRTP is implemented in 3 layers:
  
-<code>+<ditaa>
  ​+-----------------------+  ​+-----------------------+
  ​| ​  ​Application/​ports ​  |  ​| ​  ​Application/​ports ​  |
Line 30: Line 30:
  ​| ​      CRTP Link       |  ​| ​      CRTP Link       |
  ​+-----------------------+  ​+-----------------------+
-</code>+</ditaa>
  
   * **CRTP Link** is responsible for transferring the packets between the Crazyflie and the host. It will typically handles packet size and error detection.   * **CRTP Link** is responsible for transferring the packets between the Crazyflie and the host. It will typically handles packet size and error detection.
Line 41: Line 41:
 ^  **Port** ​ ^   ​**Target** ​  ​^ ​ **Used for**   ^ ^  **Port** ​ ^   ​**Target** ​  ​^ ​ **Used for**   ^
 |   ​0 ​       |   ​[[projects:​crazyflie:​crtp:​console | Console ]]      | Read console text that is printed to the console on the Crazyflie using consoleprintf | |   ​0 ​       |   ​[[projects:​crazyflie:​crtp:​console | Console ]]      | Read console text that is printed to the console on the Crazyflie using consoleprintf |
-|   ​2 ​       |   ​[[projects:​crazyflie:​crtp:​param | Parameters]] ​  | Get/set parameters from the Crazyflie. Parameters are defined using a macro in the Crazyflie source-code |+|   ​2 ​       |   ​[[projects:​crazyflie:​crtp:​param | Parameters]] ​  | Get/set parameters from the Crazyflie. Parameters are defined using a [[projects:​crazyflie:​firmware:​param|macro in the Crazyflie source-code]] |
 |   ​3 ​       |   ​[[projects:​crazyflie:​crtp:​commander |Commander]] ​   | Sending control set-points for the roll/​pitch/​yaw/​thrust regulators | |   ​3 ​       |   ​[[projects:​crazyflie:​crtp:​commander |Commander]] ​   | Sending control set-points for the roll/​pitch/​yaw/​thrust regulators |
-|   ​5 ​       |   ​[[projects:​crazyflie:​crtp:​log#​communication_protocol|Log]] ​   | Set up log blocks with variables that will be sent back to the Crazyflie at a specified period. Log variables are defined using a macro in the Crazyflie source-code |+|   ​5 ​       |   ​[[projects:​crazyflie:​crtp:​log#​|Log]] ​   | Set up log blocks with variables that will be sent back to the Crazyflie at a specified period. Log variables are defined using a [[projects:​crazyflie:​firmware:​log|macro in the Crazyflie source-code]] | 
 +|   ​7 ​       |   ​[[projects:​crazyflie:​crtp:​setpointgeneric | Setpoint Generic]] | For sending generic, extensible setpoints ​|
 |   ​14 ​      ​| ​  ​[[projects:​crazyflie:​pc_utils:​debugdriver|Client-side debugging]] ​   | Debugging the UI and exists only in the Crazyflie Python API and not in the Crazyflie itself. ​ | |   ​14 ​      ​| ​  ​[[projects:​crazyflie:​pc_utils:​debugdriver|Client-side debugging]] ​   | Debugging the UI and exists only in the Crazyflie Python API and not in the Crazyflie itself. ​ |
 |   ​15 ​      ​| ​  ​[[projects:​crazyflie:​crtp:​linklayer |Link layer ]]   | Used to control and query the communication link | |   ​15 ​      ​| ​  ​[[projects:​crazyflie:​crtp:​linklayer |Link layer ]]   | Used to control and query the communication link |
Line 56: Line 57:
  
 ===== Serial port ===== ===== Serial port =====
-This is mostly for legacy support but has been used during development to log data at higher speedsThe support for using the serial port might be broken currently though.+The serial port is configured in 115200 8N1CRTP packets are sent and received asynchronously ​using the following packet format:
  
 <​code>​ <​code>​
 +  7   ​6 ​  ​5 ​  ​4 ​  ​3 ​  ​2 ​  ​1 ​  0
 ++---+---+---+---+---+---+---+---+
 +|             ​0xAA ​             |
 ++---+---+---+---+---+---+---+---+
 +|             ​0xAA ​             |
 ++---+---+---+---+---+---+---+---+
 +|      Port     ​| ​ Res  | Chan. |
 ++---+---+---+---+---+---+---+---+
 +|         ​Packet length ​        |
 ++---+---+---+---+---+---+---+---+
 +|            DATA 0             |
 ++---+---+---+---+---+---+---+---+
 +:   : ​  : ​  : ​  : ​  : ​  : ​  : ​  :
 ++---+---+---+---+---+---+---+---+
 +|            Cksum              |
 ++---+---+---+---+---+---+---+---+
 +
 +--------+--------+--------+--------+--------+--....--+--------+ +--------+--------+--------+--------+--------+--....--+--------+
-|  0xAA  |  0xAA  | Header | Length | Data0  | Packet | CRC32  |+|  0xAA  |  0xAA  | Header | Length | Data0  | Packet | Cksum  |
 +--------+--------+--------+--------+--------+--....--+--------+ +--------+--------+--------+--------+--------+--....--+--------+
 +
 </​code>​ </​code>​
-^ **Field** ^ **Byte** ^     ​**Description** ​    ^ +^ **Field** ^ **Byte** ^ **Bit** ^     ​**Description** ​    ^ 
-|   ​Start ​  ​| ​   0-1   | Start token for synchronization (0xAAAA) ​ | +|   ​Start ​  ​| ​   0-1   |   ​0-2 ​  | Start token for synchronization (0xAAAA) ​ | 
-|   ​Header ​ |     ​2 ​   | The destination channel ​ | +|   ​Header ​ |     ​2 ​   ​|   ​0-1 ​  | The destination channel ​ | 
-|    Size   ​| ​    ​3 ​   | The size of the packet ​+|    :::    |     ​2 ​   |   ​2-3 ​  | Reserved for the link layer | 
-|    Data   ​| ​   4-34  | The data in the packet | +|    :::    |     ​2 ​   |   ​4-7 ​  | The destination port  | 
-|    CRC    ​|   35-36  ​| ​The CRC16 of the packet ​|+|    Size   ​| ​    ​3 ​   |         | Number ​of data byte 
 +|    Data   ​| ​   4-..  |         | The data in the packet | 
 +|   Cksum   ​| ​ 4+size ​ ​| ​        | Checksum. Sum of all the bytes, excluding //Start//, modulo 256. |
  
 +==== Example ====
 +To send setpoints to the [[projects:​crazyflie:​crtp:​commander|commander]] send: 
 +<​code>​
 +0xaa 0xaa 0x30 0x0e 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3e
 +</​code>​
 +
 +To ping Crazyflie:
 +<​code>​
 + ​-> ​  0xaa 0xaa 0xf0 0x01 0x01 0xf2     # Sent to the copter ​
 + <​- ​  0xaa 0xaa 0xf0 0x01 0x01 0xf2     # Received from the copter
 +</​code>​
projects/crazyflie/crtp.1361513232.txt.gz · Last modified: 2015-07-15 16:30 (external edit)