Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros
Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros
Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros
Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros
Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros arm_servos_pubs_subs

Repository Summary

Description Control of a Hiwonder 6-Servo xArm Manipulator with an ESP32 and ROS2
Checkout URI https://github.com/migsdigs/hiwonder_xarm_esp32.git
VCS Type git
VCS Version main
Last Updated 2024-01-28
Dev Status UNKNOWN
Released UNRELEASED
Tags robotics esp32 servo-motor ros2 microros
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
arm_servos_pubs_subs 0.0.0

README

# Hiwonder xArm ESP32 Control with ROS2 This repository is intended for the control of a Hiwonder xArm, that utilises 6 bus servos, with an ESP32 micro and micro-ROS for control on a master machine. The ESP32 is essentially utilised as a motor driver, while micro-ROS is utilized to set and read parameters of the motors using defined ROS publishers, subscribers and messages.

  • Parameters that can be set: Servo angle/position (and time to execute respective movements)
  • Parameters that can be read: Servo angle/position, servo input voltage, servo temperature

For the use of these motors with an ESP32 and ROS1-Rosserial, please go to this link.

For the setup of the environment, including ROS2 installation and workspace, micro-ROS installation and setup of the IDE **please see the Setup README.**

Test System: Ubuntu 22.04 on WSL, ROS2 Humble Hawksbill, Micro-ROS, ESP32-DevkitC-32E with PlatformIO in VS Code as the dev environment

Author: Miguel Garcia Naude


Hardware Setup

  • Hiwonder xArm ESP32
  • ESP32-DevKitC-32e
Front View Side View
drawing drawing
Servo Number Model Range (deg.) Rotation Speed Parameter Feedback
1 ID1 Servo 160 deg. 0.39 sec/60deg Position, Temperture, Voltage
2 LX-15D Servo 240 deg. 0.22 sec/60deg Position, Temperture, Voltage
3 LX-15D Servo 240 deg. 0.22 sec/60deg Position, Temperture, Voltage
4 LX-15D Servo 240 deg. 0.22 sec/60deg Position, Temperture, Voltage
5 LX-225 Servo 240 deg. 0.23 sec/60deg Position, Temperture, Voltage
6 LX-15D Servo 240 deg. 0.22 sec/60deg Position, Temperture, Voltage

Electronics Setup

drawing

Servos can be daisy chained together. Thus all six servos may be chained together and connected as a single pin at GPIO pin 33 on the ESP32. It was found that the system experiences communication errors with the servos regularly when more than three servos are daisy chained together. As such they can be connected in parallel at pin 33. Two pairs of three chained servos are thus connected in parallel to pin 33.


Basic Operation

Power On

  1. Ensure that the servos are powered on (their LEDs will light up) with the 7.5V source.
  2. Power on the ESP32 by plugging it in with the micro-USB.
  3. Ensure that the Serial lines of the servos are connected to Pin 33 of the ESP32
  4. Ensure that the servos and the ESP32 have a common ground.

Build & Run

Note again: see setup readme for installation instructions.

Change directory to that of your micro-ROS. In my case this is done with:

cd esp32_microros_ws
pwd
/home/miguel_u22/esp32_microros_ws

Inside this directory there should be the following:

miguel_u22@miguelpc:~/esp32_microros_ws$ ls
build  install  log  src

Source the setup.bash file in the install folder:

source install/setup.bash

If you are confident this will not create any conflicts, you can add this line to the ~/.bashrc so you do not have to source the micro-ROS workspace everytime:

echo "source /home/miguel_u22/microros_ws/install/setup.bash" >> ~/.bashrc    # replace with file path with your own

Run

  1. Plug the ESP32 into the host PC with the USB.
  2. In the micro-ros directory (for me /home/miguel_u22/esp32_microros_ws), run the micro-ROS agent: ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyUSB0 -v6

    This should produce the following response:

```bash [1696498217.465170] info | TermiosAgentLinux.cpp | init | running… | fd: 3 [1696498217.465918] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6 [1696498226.028623] info | Root.cpp | create_client | create | client_key: 0x340D845A, session_id: 0x81 [1696498226.028907] info | SessionManager.hpp | establish_session | session established | client_key: 0x340D845A, address: 0 [1696498226.029119] debug | SerialAgentLinux.cpp | send_message | [** «SER» ] | client_key: 0x340D845A, len: 19, data: 0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00 [1696498226.041597] debug | SerialAgentLinux.cpp | recv_message | [==» SER «==] | client_key: 0x340D845A, len: 52, data: 0000: 81 80 00 00 01 07 2A 00 00 0A 00 01 01 03 00 00 1B 00 00 00 00 01 FB 3F 13 00 00 00 48 69 77 6F 0020: 6E 64 65 72 5F 78 41 72 6D 5F 6E 6F 64 65 00 00 00 00 00 00 [1696498226.064239] info | ProxyClient.cpp | create_participant | participant created | client_key: 0x340D845A, participant_id: 0x000(1) [1696498226.064379] debug | SerialAgentLinux.cpp | send_message | [ «SER» ] | client_key: 0x340D845A, len: 14, data: 0000: 81 80 00 00 05 01 06 00 00 0A 00 01 00 00 [1696498226.064408] debug | SerialAgentLinux.cpp | send_message | [ «SER» **] | client_key: 0x340D845A, len: 13, data: 0000: 81 00 00 00 0A 01 05 00 01 00 00 00 80

File truncated at 100 lines see the full file

Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros
Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros
Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros
Repo symbol

hiwonder_xarm_esp32 repository

robotics esp32 servo-motor ros2 microros