ros2_esp32bot
ros2_esp32bot copied to clipboard
Simple ESP32 bot for connecting ROS2
ROS2_ESP32Bot
Dependency
- ROS2 Dashing Diademata
- ros2arduino 0.1.3
- Micro-XRCE-DDS Agent 1.1.0
Prepare Hardware
Build a your own bot
I bought below parts.
- ¥1,480 ESP32-DevKitC-32D
- ¥350 AE-TB6612
- ¥90 AZ0526
Setup dependency
Setup Micro-XRCE-DDS Agent
You need to setup Micro-XRCE-DDS Agent for using ros2arduino.
Arduino ESP32
If you have not setup arduino environment yet, you can check the instraction at here
Getting started
Make sure you need an access point.
$ git clone https://github.com/shirokunet/ros2_esp32bot
$ cd ros2_esp32bot/main/
$ cp network_config_templrate.h network_config.h
$ vi network_config.h
#define SSID ""
#define SSID_PW ""
#define AGENT_IP ""
#define AGENT_PORT 2018
And write the .ino file into your ESP32.
Run ROS2 nodes for sending commands
Run MicroXRCEAgent
$ MicroXRCEAgent udp -p 2018 -v 6
If you get error messages like below:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)
Try to run.
$ LD_PRELOAD="/usr/local/lib/libfastrtps.so.1 /usr/local/lib/libfastcdr.so.1" MicroXRCEAgent udp -p 2018
Run joy_node
$ ros2 run joy joy_node
Run teleop_node
$ ros2 run teleop_twist_joy teleop_node
Useful commands for debugging
$ ros2 node list
$ ros2 topic list
$ ros2 topic echo /esp32bot/status
$ ros2 topic echo /esp32bot/chatter
$ ros2 topic echo /joy
$ ros2 topic echo /cmd_vel
teleop_twist_joy for Logicool Gamepad F310
If you do not have a PS4 controller, you can buy F310 and use my repository.