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
This demo aims to expose a **micro-ROS** use case. It runs on a pair of embedded devices:
9
-
a [**Crazyflie 2.1**](https://www.bitcraze.io/crazyflie-2-1/) drone, used as a user controller,
10
-
and a [**Kobuki Turtlebot 2**](https://www.turtlebot.com/turtlebot2/) as a mobile and controlled device.
8
+
This demo is a proof concept, which aims to demostrate the versatility of the Micro-ROS project to be adapted to an already exciting product, with constrain memory size and respecting the original firmware. On this demostration we're going to work with the [Crazyflie 2.1 Drone](https://www.bitcraze.io/products/crazyflie-2-1/). This is a tiny and open-source drone which has the next characteristics:
- Radio and power management by nRF51822 MCU (Up to 1 Km of range)
11
+
- BMI088 IMU
12
+
- BMP388 barometric sensor
13
+
- 100 mAH battery which gives an autonomy of up to 7 minutes.
14
+
- Dimensions: 92x92x92 mm
15
+
- Takeof weight: 27g
11
16
12
-

17
+

13
18
14
-
Both of them rely on **micro-ROS** publication and subscription mechanisms and use an underlying [**Micro XRCE-DSS client**](https://micro-xrce-dds.readthedocs.io/en/latest/).
19
+
The main challenge of this demo, was been able to fit Micro-ROS inside of the already existing firmware which with all the features active use around the 60% of the MCU RAM memory and X of the flash memory. Thanks to the modular design of micro-ROS and the versatile configuration system, is possible to fit micro-ROS full stack on this tiny device.
15
20
16
-
This demo also includes conventional ROS 2 tooling as a demonstration of integration with **ROS 2**. We use Gazebo, RVIZ and simple ROS 2 nodes (aka **external nodes**) acting as data converters.
21
+
On the next points we will see the functionalities of this micro-ROS demo and how you can reproduce it.
17
22
18
-
This demo was developed taking as base the [Kobuki demo](/docs/tutorials/demos/kobuki_demo).
* 1 x [Crazyflie 2.1](https://www.bitcraze.io/crazyflie-2-1/),
26
+
* 1 x [Crazyradio PA](https://www.bitcraze.io/crazyradio-pa/),
27
+
* 1 x [Flow deck v2](https://www.bitcraze.io/flow-deck-v2/),
28
+
* 1 x [Crazyflie-compatible remote controller](https://www.bitcraze.io/docs/crazyflie-clients-python/master/inputdevices/).
31
29
32
-
## Setup
30
+
## Reproduce the demo
31
+
On the next points, we will see a set of steps that you need to follow to succeed on the demo reproduction.
32
+
(Note: Is necessary to install previously ROS2 Dashing, you can find instructions here: [ROS2 Dashing](https://index.ros.org/doc/ros2/Installation/Dashing/))
33
+
### Work Space set-up and configuration
33
34
34
-
The proposed demo is composed of different kind of messages and topics.
35
-
36
-
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 can run a node that publishes:
37
-
- its own relative position as a 3D vector (X, Y and Z) using a *geometry_msg/Point32* message type on */drone/odometry* topic.
38
-
- its own attitude as a 3D vector (pitch, roll and yaw) using a *geometry_msg/Point32* message type on */drone/attitude* topic.
39
-
40
-
The **Kobuki Turtlebot 2** robot is controlled using a UART protocol through a custom DB25 connector. The micro-ROS node runs on an 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 can communicate with the robot (UART) and with the ROS2 world (integrated Ethernet). Its used topics are:
41
-
- a subscription on */cmd_vel* topic (*geometry_msg/Twist* message type) to receive the controlling angular and linear velocity.
42
-
- a publication on */robot_pose* topic (*geometry_msg/Vector3* message type) which includes X position, Y position and robot yaw.
43
-
44
-
The **external ROS 2 nodes** are rclpy tools with some different functionalities:
45
-
-*attitude_to_vel.py*
46
-
- 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.
47
-
- Converts Crazyflie publications on */drone/attitude* and */drone/attitude* topics to *tf2_msgs/TFMessage* messages (required by RVIZ visualizer)
48
-
-*odom_to_tf.py*
49
-
- Converts Kobuki Turtlebot 2 publications on */robot_pose* topic to *tf2_msgs/TFMessage* messages (required by RVIZ visualizer).
After installation, the following packages should be present in your system:
109
+
# Execute xhost
110
+
xhost +
229
111
112
+
# Execute docker compose to build all the requiered work space
113
+
docker-compose up -d
230
114
```
231
-
.
232
-
+-- Micro-XRCE-DDS # used for installing Micro-XRCE-DDS
233
-
+-- crazyflie_demo
234
-
+-- crazyflie-firmware # used for building and flashing Crazyflie 2.1 firmware
235
-
+-- kobuki-firmware # used for building and flashing Kobuki Turtlebot 2 firmware
236
-
+-- crazyflie-clients-python
237
-
```
238
-
239
-
Make sure that all ROS 2 or micro-ROS nodes created along with the following steps **can reach each other using its network interfaces**.
115
+
This last step could take a while the first time that you execute it, but later on executions, it will execute almost inmediatly.
240
116
241
-
## Run Kobuki Turtlebot 2 Node
117
+
If everything goes fine, it should appear RVIZ and CrazyFlies Client. Each application, has the next utility:
118
+
- RVIZ: Shows an animation of the drone, drawing de flight trayectory on screen. This data are obtained from the ROS2 topic published by the drone.
119
+
- CrazyFlie Client: Shows the telemetry status of the drone, allows us to modify the configuration of the device and works as communication bridge between the CrazyFlie radio protocol and the micro-ROS network.
242
120
243
-
TODO: Explain data and power connections between Kobuki Turtlebot 2, Olimex STM32-E407 and MiniRouter.
121
+
Once open it should look like this:
122
+
<!-- Add image of RVIZ and Crazyflie without connection-->
Push the reset buttom of the drone. The drone will perform an internal check status which if goes fine it should do the next:
125
+
- Move the propellers producing a "melody".
126
+
- Turning on statically two blue and one red light.
127
+
- Blinking the yellow LED.
251
128
252
-
**micro-ROS Agent** should receive an incoming client connection and */robot_pose* topic should be published. Check it with `ros2 topic echo /robot_pose`
129
+
Finally you need to do the next steps:
130
+
- Connect the USB radio dongle.
131
+
- Push the buttom scan on the Crazyflie Client.
132
+
- On the left menu it should appear an interface called ```` select it.
133
+
- Finally Push the buttom connect.
253
134
254
-
## Run Crazyflie 2.1 Node
255
-
256
-
Connect Crazyradio PA 2.4 GHz USB dongle and turn on Crazyflie 2.1 drone.
257
-
258
-
Run the Crazyflie Client + Bridge:
259
-
```
260
-
cd crazyflie-clients-python
261
-
python3 bin/cfclient
262
-
```
135
+
The part of the menu that you need to manipulate is highlited on the next image:
136
+

263
137
264
-
This command should open the Crazyflie Client and print a serial device path in the terminal (something like /dev/pts/0).
138
+
Now everything is ready and the Crazyflie Client should return the telemetry data and the RVIZ should start to show drone trajectory like on the bottom image:
139
+
<!--- Add Image with drone working properly-->
265
140
266
-
Run (in another prompt) a **Micro XRCE-DDS Agent**:
267
-
```
268
-
MicroXRCEAgent serial --dev [serial device]
141
+
Finally, if you want to close this utilities properly, you need to execute the next command:
142
+
```bash
143
+
docker-compose down
269
144
```
270
145
271
-
**Micro XRCE-DDS 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`
146
+
## Demo functionality
272
147
148
+
Once everything is ready you can check on the ROS2 network the telemetry of the drone. On the next image, you see the available topics and how interact it with RVIZ.
Is possible to fly the drone at the same time that micro-ROS is running inside of it. To do so, you need to follow the next guide which explains how to connect a compatible controller to the host PC to fligth it.
301
159
302
-
RVIZ windows should be open and a Crazyflie 2.1 drone model should represent **only** the drone attitude.
0 commit comments