User Tools

Site Tools


doc:crazyflie:client:pycfclient:zmq

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
Last revision Both sides next revision
doc:crazyflie:client:pycfclient:zmq [2015-07-14 11:38]
macke [Paramters]
doc:crazyflie:client:pycfclient:zmq [2019-09-05 15:27]
kimberly
Line 1: Line 1:
 +<WRAP center round important 60%>
 +This page is deprecated and is moved to the main Bitcraze website. Please go to:
  
 + [[
 +https://www.bitcraze.io/docs/crazyflie-clients-python/master/cfclient_zmq/
 +]]
 +
 +</WRAP>
 +
 +
 +
 +The [[doc:crazyflie:client:pycfclient:index|Crazyflie Python client]] runs a number of back-ends where you can set/get information from other applications via [[http://zeromq.org/|ZMQ]].
 +
 +Here's a list of the ports/functions available:
 +^ Port ^ Type ^ Functionality ^
 +| 1213 | REQ  | Set parameters |
 +| 1214 | PUSH | LED-ring memory  |
 +| 1212 | PULL | Input device  |
 +
 +
 +====== Parameters ======
 +The parameter back-end gives access to setting parameters in the Crazyflie. The back-end is enabled by default.
 +
 +===== Protocol =====
 +<WRAP group>
 +<WRAP half column>
 +Available fields:
 +^  Field  ^  Format  ^  Comments  ^
 +| version | int | Should be set to 1 |
 +| cmd     | string | Command to send (currently only set is supported) |
 +| name    | string | The name of the parameter |
 +| value   | string | The value of the parameter |
 +</WRAP>
 +<WRAP half column>
 +Example of setting the //buzzer.freq// parameter to 4000.
 +<code>
 +{
 +  "version": 1,
 +  "cmd": "set",
 +  "name" : "buzzer.freq",
 +  "value": "4000"
 +}
 +</code>
 +</WRAP>
 +</WRAP>
 +
 +====== LED-ring ======
 +The LED-ring back-end gives access to the LED-ring memory driver where the user can write the RGB values for all 12 LEDs on the ring. The back-end is enabled by default.
 +
 +===== Protocol =====
 +<WRAP group>
 +<WRAP half column>
 +Available fields:
 +^  Field  ^  Format  ^  Comments  ^
 +| version | int | Should be set to 1 |
 +| rgbleds | array of 3 item arrays of int | R/G/B value for each LED (starting at 1) |
 +</WRAP>
 +<WRAP half column>
 +Example of setting all LEDs off:
 +<code>
 +{
 +  "version": 1,
 +  "rgbleds": [
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0],
 +    [0, 0, 0]
 +  ]
 +}
 +</code>
 +</WRAP>
 +</WRAP>
 +
 +====== Input device ======
 +If you don't want to use the API and you don't want to bother about scanning/connecting/logging/etc or there's no API for the environment you use, there's an easy way to control the Crazyflie. Just like you would control the Crazyflie with a gamepad or joystick connected to a computer, you can use ZMQ to inject control set-points directly into the client. You still use the client for connecting/logging/graphing/setting parameters, it's just the control part that's broken out.
 +
 +By default this is disabled in the configuration file and needs to be enabled. The configuration file parameter is named //enable_zmq_input// (see [[doc:crazyflie:dev:host:client:index#user_configuration_file|this]] to edit the configuration). To enable controlling by the back-end select the //ZMQ@127.0.0.1:1212// input device in the //Input device// menu.
 +
 +===== Protocol =====
 +<WRAP group>
 +<WRAP half column>
 +Available fields:
 +^  Field  ^  Format  ^  Comments  ^
 +| version | int | Should be set to 1 |
 +| client_name | string | Name of the client (currently unused) |
 +| ctrl | dict | A dictionary with keys and values that match the internal names of controls in the client  (see list below)|
 +
 +Available keys for the //ctrl// dictionary:
 +^  Field  ^  Range  ^  Unit  ^  Comments  ^
 +| roll | N/A | degrees | |
 +| pitch | N/A | degrees | |
 +| yaw | N/A | degrees/second | |
 +| thrust | 0-100 | Percent | |
 +| estop | T/F | boolean | Used to stop the Crazyflie and disable the control |
 +| alt1 | T/F | boolean | Alt1 is internally mapped to functionality like switching LED-ring effect |
 +| alt2 | T/F | boolean | Alt2 is internally mapped to functionality like switching LED-ring headlights on/off |
 +</WRAP>
 +<WRAP half column>
 +Example:
 +<code>
 +{
 +    "version": 1,
 +    "client_name": "ZMQ client",
 +    "ctrl": {
 +        "roll": 0.0,
 +        "pitch": 0.0,
 +        "yaw": 0.0,
 +        "thrust": 0.0
 +    }
 +}
 +</code>
 +</WRAP>
 +</WRAP>
 +
 +**NOTE1**: Altitude hold is currently not working.
 +
 +**NOTE2**: The values are used at 100Hz in the client, no matter at what rate they are sent via ZMQ
doc/crazyflie/client/pycfclient/zmq.txt · Last modified: 2020-05-12 14:28 by kimberly