You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7f0498d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: _docs/tutorials/demos/crazyflie_demo/index.md
+283-1Lines changed: 283 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,4 +5,286 @@ redirect_from:
5
5
- /crazyflie_demo/
6
6
---
7
7
8
-
WIP
8
+
# Crazyflie + Turtlebot demo
9
+
10
+
This demo aims to expose an use case of **Micro ROS** running on a pair or embedded devices: a [**Crazyflie 2.1**](https://www.bitcraze.io/crazyflie-2-1/) drone, used as an user controller and a [**Kobuki Turtlebot 2**](https://www.turtlebot.com/turtlebot2/) as a mobile and controlled device.
11
+
12
+
Both of them rely on **Micro ROS** publication and subscription mechanisms and use an underlaying [**MicroXRCEDSS client**](https://micro-xrce-dds.readthedocs.io/en/latest/).
13
+
14
+
In order to show the integration with **ROS2**, this demo also includes common ROS2 tooling such as Gazebo, RVIZ and simple ROS2 nodes (aka **external nodes**) acting as data converters.
The proposed demo is composed by different kind of messages and topics.
36
+
37
+
The **Crazyflie 2.1** drone relies on [ST STM32F405](https://www.st.com/en/microcontrollers-microprocessors/stm32f405-415.html) MCU running **[FreeRTOS](https://www.freertos.org/)**. Using the RTOS capabilities and the integrated radio communication device, the drone is able to run a node that publish:
38
+
- its own relative position as a 3D vector (X, Y and Z) using a *geometry_msg/Point32* message type on */drone/odometry* topic.
39
+
- its own attitude as a 3D vector (pitch, roll and yaw) using a *geometry_msg/Point32* message type on */drone/attitude* topic.
40
+
41
+
The **Kobuki Turtlebot 2** robot is controlled using a UART protocol through a custom DB25 connector. The Micro ROS node runs on a Olimex STM32-E407 board attached to that UART port. This hardware features a [ST STM32F407](https://www.st.com/en/microcontrollers-microprocessors/stm32f407-417.html) MCU running **[Nuttx](https://nuttx.org/)** RTOS. In the same way, this node is able to communicate with the robot (UART) and with the ROS2 world (integrated Ethernet). Its used topics are:
42
+
- a subscription on */cmd_vel* topic (*geometry_msg/Twist* message type) to receive the controlling angular and linear velocity.
43
+
- a publication on */robot_pose* topic (*geometry_msg/Vector3* message type) which includes X position, Y position and robot yaw.
44
+
45
+
The **external ROS2 nodes** are rclpy tools with some different functionalities:
46
+
-*attitude_to_vel.py*
47
+
- Converts Crazyflie */drone/attitude* to Kobuki Turtlebot 2 */cmd_vel* so that drone pitch is mapped to robot linear velocity and drone roll to angular valocity.
48
+
- Converts Crazyflie publications on */drone/attitude* and */drone/attitude* topics to *tf2_msgs/TFMessage* messages (required by RVIZ visualizer)
49
+
-*odom_to_tf.py*
50
+
- Converts Kobuki Turtlebot 2 publications on */robot_pose* topic to *tf2_msgs/TFMessage* messages (required by RVIZ visualizer).
**Micro ROS Agent** should receive an incoming client connection and */robot_pose* topic should be published. Check it with `ros2 topic echo /robot_pose`
239
+
240
+
## Run Crazyflie 2.1 Node
241
+
242
+
Connect Crazyradio PA 2.4 GHz USB dongle and turn on Crazyflie 2.1 drone.
243
+
244
+
Run the Crazyflie Client + Bridge:
245
+
```
246
+
cd crazyflie-clients-python
247
+
python3 bin/cfclient
248
+
```
249
+
250
+
This command should open the Crazyflie Client and print a serial device path in the terminal (something like /dev/pts/0).
251
+
252
+
Run (in another prompt) a **MicroXRCE Agent**:
253
+
```
254
+
MicroXRCEAgent serial --dev [serial device]
255
+
```
256
+
257
+
**MicroXRCE Agent** should receive an incoming client connection and */drone/attitude* and */drone/position* topics should be published. Check it with `ros2 topic echo /drone/attitude` and `ros2 topic echo /drone/position`
0 commit comments