HexArth

From Waveshare Wiki
Jump to: navigation, search
HexArth
HexArth

HexArth Bionic Hexapod Robot, TTL Bus Servo Control Interface, I2C/UART
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Introduction

HexArth is a bionic hexapod robot with 18 degrees of freedom, equipped with 18 high-torque servos (30kg.cm), featuring a reliable structure and flexible movements. It includes a 9-axis motion tracker and offers an open-source, cross-platform Web application for control. Simply access the robot's control interface using a browser on a mobile phone or computer. The ESP32 can be used as the lower computer for linkage inverse kinematics and gait generation, offloading computational tasks from the upper computer. A Raspberry Pi can also be installed as the upper computer for advanced decision-making computations.

Features

  • 18 degrees of freedom (DOF), with more flexible and diverse movements.
  • ICM20948 9-axis motion tracker with self-balancing mode available.
  • High-torque servo (30kg.cm), with stall torque up to 30kg.cm, offering stronger expandability.
  • Structural components made of 5052 aluminum alloy and PA12 nylon, ensuring sturdy and reliable construction.
  • Integrated with various interactive devices, including a 0.96inch OLED screen, two RGB-LED indicators, etc.
  • The demo is developed using Arduino IDE, and there is no need to manually configure the compilation environment. The ESP32 will automatically establish a WIFI hotspot when it is turned on, you can use a mobile phone (Android/iOS) or a computer (Linux/Windows/Mac). Only a browser based on Chromium is required, and there is no need to download an app.
  • With a charging port and an automatic download circuit, you can use it while charging.
  • Powered by six 18650 batteries, 4000mAh large capacity, providing higher output current and stronger servo power.
  • Battery protection circuit with overcharge, over-discharge, over-current, and short-circuit protection.
  • Onboard INA219 acquisition chip, convenient for real-time monitoring of battery voltage and charging current.
  • The Raspberry Pi can be installed as the upper computer to communicate with the lower computer through the serial port. The ESP32, as the lower computer, can share a lot of computing power for inverse kinematics and gait generation computation, leaving more resources for Raspberry Pi to develop advanced functions.
  • Open-source STEP models, facilitating secondary development.
  • Most configuration settings can be achieved via JSON commands, e.g., configuring WiFi connection without a USB cable.
  • All code is open source and rich development documentation and tutorials are provided.

Product Firmware Update

  • If the OLED screen shows `HexArth Version:0.84` when the robot powers on, the driver on the robot is already the new version, and you do not need to perform this update section.
  • If the OLED screen does **not** show `HexArth Version:0.84` when the robot powers on, the driver is still the old version, and you **must** perform this update section. This section can also be used to restore factory settings.

We provide a dedicated ESP32 download tool for HexArth, allowing users to quickly update the firmware or restore to the factory program.

1. First, connect the robot to your computer using a USB cable. (This step requires opening the robot to access the USB interface in the middle of the driver board).

2. Download the HexArth ESP32 download tool: HexArth ESP32 download tool. After downloading, unzip and double-click to open the "flash_download_tool_3.9.5.exe" program. After opening, two windows will pop up, we need to operate the UI interface of the download tool, and the other window will act as a terminal to show the working status of the download tool.

3. In the "DOWNLOAD TOOL MODE" interface, select ChipType as ESP32 and WorkMode as Factory. When using Factory, the binary file will be called using a relative path, so the user does not need to manually input the binary file path. After selecting, click OK.

WAVEROVER下载工具.png

4. In this software interface, keep the "LockSettings" checkbox selected. The right side indicates the ability to upload programs to up to 8 HexArth robots simultaneously. Click "COM", and select the new COM (the new COM here is COM3); BAUD is used to set the download speed, the higher the value, the faster the speed, and it can be up to 921600 for ESP32.

企业微信截图 17700195407627.png

5. After selection, click "START" to start uploading the program. Once the upload is complete, "IDLE WAIT" will change to "FINISH COMPLETE". After completion, you can disconnect the USB connection between the driver board and the computer, turn on the switch of the robot product, and control the robot after powering on.

企业微信截图 17700197644801.png

Product Basic Usage

Precautions Before Use (MUST READ!!)

Please read the following before use:

  1. The product does **not** come pre-installed with a lithium battery pack. The customer must install a suitable battery pack for normal operation. Overseas customers need to purchase their own battery pack. A 4000mAh or higher capacity 18650 lithium battery pack with a discharge rate of 10C is recommended.
  2. The product should **not** be subjected to severe impacts and is **not** waterproof or sandproof.

First Time Use

900px-Hexarth2.jpg

The first time you use it, you will need to plug it into the robot's power connector using the configured 12.6V 2A charger. After you turn on the power switch, the robot will initialize, and the OLED screen will display a series of initializations.

  1. The meaning of the display on the OLED screen after the robot is turned on is as follows:
    • The first line indicates the WiFi is in AP mode, where the robot creates a hotspot named `HexArth`.
    • The second line indicates STA mode is off. When WiFi is in STA mode, the router assigns an IP address to the robot, which is displayed here.
    • The third line shows the device's unique MAC address, used for ESP-NOW communication.
    • The fourth line U indicates the power supply voltage of the robot.
  2. After booting up, use your phone or computer to connect to the robot's WiFi: HexArth, the password is 12345678. After connecting to WiFi, open Google Chrome and enter 192.168.4.1 in the URL bar to open the Web interface. You can now use the Web buttons to control the robot or send JSON commands via the Web interface.

Lower Computer Web Usage

Hexarthweb.png

  • This Web interface displays real-time information: Voltage (VOLTAGE), WIFI signal strength in STA mode (RSSI), IP, and MAC address.
  • Use the directional buttons to control robot movement. The LEFT and RIGHT buttons below control in-place rotation. INIT is for robot initialization. STEADY START/END turns the robot's self-balancing mode on/off (movement controls are disabled when self-balancing is active). The SLOW, MIDDLE, FAST buttons set the robot's movement speed.
  • Other buttons become active when external modules are connected. IO4, IO5, and OFF control LED lights.

UGV-web界面1.png

  • The FEEDBACK INFORMATION window is for sending JSON commands to the robot. The section below the input box contains specific JSON command examples.
  • The Web interface includes a "heartbeat detection" feature. After opening the interface, the Web app maintains continuous communication with the robot. If the connection is lost during movement, the robot will automatically stop within a short time for safety.
  • This Web application is fully open-source. You can modify the interface and functionality by editing `Claws_web_page.h` in the open-source example code.


JSON Command Tutorial

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data exchange format, typically used for transmitting and storing data between different systems. JSON originally originated from JavaScript, but it has become an independent data format from programming languages and can therefore be used and parsed in various programming languages.

The following is a JSON command example for controlling the robot's left/right wheel speed:

{"T":1,"X":0.02,"Y":0.02,"Yaw":0.3}

Explanation of this command:

"T" represents the command type, defined in the lower-level program's header file `json_cmd.h`. A value of 1 indicates this command is `CMD_SPEED_CTRL` (used to control robot X, Y speed, and body rotation).

Why Use JSON Commands to Interact with the Robot?

Given the abundant onboard resources of the robot's driver board, rich example functionalities, and the need to conveniently support upper computers for more extensive and flexible control, we use JSON command communication for interaction. Similarly, you can perform secondary development based on this existing framework to tailor the robot's functions to your specific needs.

Communication Methods Supporting JSON Commands

The robot supports multiple methods for JSON command interaction. Wired methods include serial communication via the RX/TX pins or USB serial communication via the Type-C interface. Wireless methods include communication via HTTP requests or ESP-NOW. You can use the examples below to send corresponding JSON commands using different methods to control various robot functions.

The robot has a built-in heartbeat function: if no new movement control command is received within 3 seconds, the robot will automatically stop. Therefore, when controlling the robot via an upper computer, you need to periodically repeat movement commands to keep it moving continuously.

1. Serial/USB Communication

Features: Wired connection, default baud rate @115200, bidirectional communication, stable, low latency.

Purpose: Convenient for controlling the robot with upper computers like PC, Raspberry Pi, etc.

Connection Methods:

  • Connect the robot's 40PIN UART interface to a Raspberry Pi.
  • Connect the lower driver board's USB interface to the upper computer using a USB cable (requires disassembling the robot).

Python demo: [1]. The specific example content is as follows:

import serial
import argparse
import threading

def read_serial():
    while True:
        data = ser.readline().decode('utf-8')
        if data:
            print(f"Received: {data}", end='')

def main():
    global ser
    parser = argparse.ArgumentParser(description='Serial JSON Communication')
    parser.add_argument('port', type=str, help='Serial port name (e.g., COM1 or /dev/ttyUSB0)')

    args = parser.parse_args()

    ser = serial.Serial(args.port, baudrate=115200, dsrdtr=None)
    ser.setRTS(False)
    ser.setDTR(False)

    serial_recv_thread = threading.Thread(target=read_serial)
    serial_recv_thread.daemon = True
    serial_recv_thread.start()

    try:
        while True:
            command = input("")
            ser.write(command.encode() + b'\n')
    except KeyboardInterrupt:
        pass
    finally:
        ser.close()


if __name__ == "__main__":
    main()

Use the following command to run the serial communication program, and be sure to add the port number to which the robot is connected. Replace `COM20` with the new serial port device name assigned to the robot on your PC. If using a Raspberry Pi, Jetson Orin Nano, etc., change to the corresponding port name.

python serial_simple_ctrl.py COM20

After running, you can send JSON format commands and receive robot feedback in this interface to communicate with the robot.

2. HTTP Request Communication

HTTP (Hypertext Transfer Protocol) is a protocol used for data communication on the Web.

Features: Wireless communication based on the WIFI module, using a request-response model, is flexible and simple.

Python demo: Download the HTTP request communication demo http_simple_ctrl.py serial_simple_ctrl.py. The specific content is as follows:

import requests
import argparse


def main():
    parser = argparse.ArgumentParser(description='Http JSON Communication')
    parser.add_argument('ip', type=str, help='IP address: 192.168.10.104')

    args = parser.parse_args()

    ip_addr = args.ip

    try:
        while True:
            command = input("input your json cmd: ")
            url = "http://" + ip_addr + "/js?json=" + command
            response = requests.get(url)
            content = response.text
            print(content)
    except KeyboardInterrupt:
        pass


if __name__ == "__main__":
    main()

Before running, you need to confirm the robot's IP address, which depends on its WiFi mode.

  • If the robot's WiFi is only in AP mode, the IP address is `192.168.4.1`.
  • If the robot's WiFi is in STA mode, you can obtain its IP address from the `ST` line on the OLED screen.

Use the following command to run the HTTP request communication program. Replace the IP address in the command with your robot's IP address.

python http_simple_ctrl.py 192.168.4.1

Note: Regardless of the mode, the robot and the device running this script must be on the same local network.

3. Sending JSON Commands via the Web Application

  • After powering on, connect your phone/computer to the robot's WiFi: `HexArth`, password `12345678`. Open Google Chrome and enter `192.168.4.1` in the address bar to access the Web control interface.
  • Use the FEEDBACK INFORMATION window to send JSON commands to the robot. Specific JSON commands are listed below the window.


HexArth Tutorial Catalog

HexArth Usage Tutorials

Resources

Open Source Demo

Robot Model

Lower-level Driver Board Schematic

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)