Skip to content

ROS

中文 | English

Corresponding repository: hex_vehicle


Introduction

This open-source ROS package mainly consists of two parts: xpkg-bridge, which is responsible for converting chassis messages to ROS topics, and hex_vehicle, which listens to the /cmd_vel topic and publishes chassis messages.

The xpkg-bridge will be installed via apt, and hex_vehicle will be installed by cloning the source code.

Getting Started

First, you need to add the hexfellow apt source. You can add it automatically or manually.

1. Automatically add the hexfellow apt source using our tool

Download this script and run it: script

chmod +x add_hexfellow_apt_source.py && sudo ./add_hexfellow_apt_source.py

2. Manually add the hexfellow apt source (skip this step if added automatically)

If you don't want to use the script or if it fails, you can manually add the hexfellow apt source.
If there are old sources, remove them:

sudo rm -f /etc/apt/sources.list.d/hexfellow.sources  
sudo rm -f /etc/apt/sources.list.d/hexfellow.list  
sudo rm -f /etc/apt/sources.list.d/hexfellow.lists

Download the hexfellow GPG key:

sudo wget -q -O /usr/share/keyrings/hexfellow.gpg.key https://apt.hexfellow.com/conf/hexfellow.gpg.key

Add the following text to the /etc/apt/sources.list.d/hexfellow.sources file. If the file doesn't exist, create it:

Types: deb
URIs: https://apt.hexfellow.com/hexfellow/
Suites: !!!CHANGE TO YOUR UBUNTU CODENAME!!!
Components: main
Signed-By: /usr/share/keyrings/hexfellow.gpg.key

If you don't know your Ubuntu codename, use the lsb_release -a command to check.
For example, if your Ubuntu version is 20.04, modify the text as follows:

Types: deb
URIs: https://apt.hexfellow.com/hexfellow/
Suites: focal
Components: main
Signed-By: /usr/share/keyrings/hexfellow.gpg.key

3. Install xpkg_bridge

sudo apt update
sudo apt install ros-$ROS_DISTRO-xpkg-bridge

4. Download the hex_vehicle package

First, create a ROS workspace for ROS2 or ROS1.

Clone the hex_vehicle package into the src directory:

git clone https://github.com/hexfellow/hex_vehicle.git --recursive

5. Install protoc

This package requires a newer version of protoc. Use the following binary installation method to install protoc:

# For Linux x86_64
wget https://github.com/protocolbuffers/protobuf/releases/download/v27.1/protoc-27.1-linux-x86_64.zip
sudo unzip protoc-27.1-linux-x86_64.zip -d /usr/local
rm protoc-27.1-linux-x86_64.zip  

# For Linux arm64
wget https://github.com/protocolbuffers/protobuf/releases/download/v27.1/protoc-27.1-linux-aarch_64.zip
sudo unzip protoc-27.1-linux-aarch_64.zip -d /usr/local
rm protoc-27.1-linux-aarch_64.zip  

# Verify installation
protoc --version  # Should show libprotoc 27.1

6. Compile Protocol Buffer files

In the hex_vehicle package directory, run the following command:

./build_proto.sh

7. Control the chassis using the keyboard

  1. Compile in the workspace and load the environment variables using the source command after compilation
    • ROS1: catkin_make source devel/setup.bash
    • ROS2: colcon build source install/setup.bash
  2. Launch. You must specify the url parameter, which is the IP address of the chassis
    • ROS1: roslaunch hex_vehicle chassis_bringup.launch url:=ws://{YOUR_IP}:8439
    • ROS2: ros2 launch hex_vehicle chassis_bringup.launch.py url:=ws://{YOUR_IP}:8439
  3. Start the keyboard control node
    • ROS1: rosrun hex_vehicle chassis_key_control.py
    • ROS2: ros2 run hex_vehicle chassis_key_control

Notes

  1. Ensure that the hexfellow apt source is added and xpkg-bridge is installed before running this package.
  2. Make sure that the Protocol Buffer files are successfully compiled to generate *_pb2.py files.
  3. The /cmd_vel topic must be continuously sent; otherwise, the chassis will stop for protection.