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 is an implementation of rosserial for MicroPython, here everything needed will be found.
2
+
`rosserial` a method used by ROS in order to establish communication via serial , mostly this is used with microcontrollers, which in this case are the ones responsible in some ROS applications for actuators and sensors usage.
3
+
4
+
Since there is no rosserial package for uPy as there is for Arduino, this repo has been created where every needed script to establish rosserial with uPy will be found.
5
+
6
+
## Features
7
+
-[x] Advertising Topics
8
+
-[x] Publishing
9
+
-[ ] Subscribing
10
+
-[ ] Actions
11
+
-[ ] Services
12
+
13
+
**To Do: Subscribing testing and implementation.**
14
+
15
+
## Installation
16
+
In theory every board with the kind of generic `UART` class for ESP32 is capable of using this library, but it must be known exactly which `UART ID` is being used, this means for example, for ESP32 defined pins correspond to TX0 and RX0 for UART0, and so on. In the examples below, UART2 is used.
17
+
18
+
In order to use ros node communication, have in mind a python class for each message must be available. this means a dependency of this library is [uPy Genpy](https://github.com/FunPythonEC/uPy-genpy), used to create Python classes for messages from `*.msg` files. Follow the installation from `ugenpy` before proceeding.
19
+
20
+
Once `ugenpy` is inside, the packages `uros` and `rosserial_msgs` from `src` folder from this repository must be copied to the flash memory. I strongly recommend using [rshell](https://github.com/dhylands/rshell).
21
+
>Note: Soon this will be available to be installed with upip.
22
+
23
+
**Have in mind before publishing or subscribing to a topic, the message class must be generated with `ugenpy`**
24
+
25
+
## Usage
26
+
### Publish example
27
+
28
+
Suppose `ColorRGBA.py` has been created using `ugenpy` and `ColorRGBA.msg` file:
29
+
```
30
+
float32 r
31
+
float32 g
32
+
float32 b
33
+
float32 a
34
+
```
35
+
36
+
And then running the following e.g.:
37
+
38
+
```python
39
+
import uros
40
+
from std_msgs._ColorRGBA import ColorRGBA #message object ColorRGBA
41
+
from time import sleep
42
+
node=uros.NodeHandle(2,115200) #node initialized, for tx2/rx2 and 115200 baudrate
43
+
msg=ColorRGBA() #msg object init
44
+
msg.r=1#values to variables assigned
45
+
msg.g=3
46
+
msg.b=4
47
+
msg.a=1
48
+
whileTrue:
49
+
node.publish('Colorsh',msg) #publish data to node Colorsh
0 commit comments