Skip to content

gaolongsen/libbarrett-ROS2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patched libbarrett for Barrett WAM on Ubuntu 22.04

A maintained Ubuntu 22.04-compatible build of Barrett Technology's libbarrett for controlling the Barrett WAM and BarrettHand from modern Linux systems, including ROS 2 Humble workstations.

Ubuntu ROS 2 CAN License

Overview

libbarrett is the low-level C++ control library used by Barrett Technology hardware, including the 7-DOF WAM arm and the BH8 BarrettHand. This fork keeps the original library structure while applying compatibility fixes needed for Ubuntu 22.04 and downstream ROS 2 Humble WAM drivers.

This repository is intended to be installed before building a ROS 2 WAM workspace. The ROS 2 driver links against the installed libbarrett shared library and uses the configuration files installed under /etc/barrett.

Key Updates in This Fork

  • đź§© Ubuntu 22.04 compatibility with modern GCC/Clang and CMake.
  • đź§­ Compatibility with the Ubuntu 22.04 libconfig++ API.
  • 🛠️ C++ standard cleanup for deprecated dynamic exception specifications.
  • 📡 More robust CAN receive buffering for WAM bring-up and recovery.
  • 📦 COLCON_IGNORE marker so this folder can live inside a ROS 2 workspace without being treated as a colcon package.
  • đź§Ş Optional example and sandbox programs remain available for low-level hardware diagnostics.

Tested Platform

Component Tested version
Operating system Ubuntu 22.04 LTS
ROS ROS 2 Humble
Compiler GCC 11 / Clang 14
Build system CMake + Make
Robot Barrett WAM 7-DOF
Bus Linux SocketCAN, typically can0

Ubuntu 20.04 and ROS 1 are not the target of this fork. Use the original Barrett instructions if you need the legacy ROS 1/Ubuntu 20.04 workflow.

Repository Layout

libbarrett/
├── include/          # Public C++ headers
├── src/              # Core libbarrett implementation
├── config/           # WAM, BarrettHand, puck, gravity, and calibration configs
├── examples/         # Optional example programs
├── sandbox/          # Optional hardware debugging and experimental programs
├── programs/         # Utility programs and config installation tools
├── tests/            # Optional library tests
├── cmake/            # CMake package files
├── scripts/          # Legacy helper scripts
└── COLCON_IGNORE     # Prevents colcon from building this as a ROS package

Install Dependencies

Install the system packages needed to build this fork on Ubuntu 22.04:

sudo apt update
sudo apt install -y \
  build-essential \
  cmake \
  git \
  pkg-config \
  can-utils \
  net-tools \
  libconfig++-dev \
  libgsl-dev \
  libeigen3-dev \
  libncurses-dev \
  libboost-system-dev \
  libboost-thread-dev

Python bindings are disabled in the recommended build because they are not needed by the ROS 2 Humble WAM driver and the upstream Python support is from the Python 2 era.

Do not run scripts/install_dependencies.sh on Ubuntu 22.04. That script is kept for upstream history and was written for the older Ubuntu 20.04 low-latency setup.

Build and Install

Clone this patched fork, configure it out-of-source, build, and install:

git clone https://github.com/<your-org>/<your-libbarrett-fork>.git
cd <your-libbarrett-fork>

mkdir -p build
cd build

cmake .. \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_CXX_STANDARD=14 \
  -DWITH_PYTHON=OFF

cmake --build . -- -j$(nproc)
sudo cmake --build . --target install
sudo ldconfig

The default install location is /usr/local. After installation, the library should be visible to the dynamic linker:

ldconfig -p | grep libbarrett

Expected result:

libbarrett.so.3.0 (...) => /usr/local/lib/libbarrett.so.3.0

Configuration Files

During installation, libbarrett installs robot configuration files to:

/etc/barrett/

Check that the directory exists:

ls /etc/barrett

Typical files include:

default.conf
wam7w.conf
wam7g.conf
calibration.conf
autotension.conf

libbarrett may also read user-specific configuration from:

~/.barrett/

If ~/.barrett exists, make sure it contains valid configuration files for your exact WAM. A stale user configuration can override /etc/barrett and cause unexpected kinematics, gravity compensation, or puck behavior.

CAN Bus Setup

Most ROS 2 WAM deployments use Linux SocketCAN. Confirm that your CAN device is present:

ip link

Bring up can0:

sudo ip link set can0 down
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 txqueuelen 1000
sudo ip link set can0 up

Verify that CAN traffic is visible when the WAM is powered and connected:

candump can0

If your system uses PEAK PCAN hardware, either the in-kernel SocketCAN driver or PEAK's driver may be used depending on your lab setup. The ROS 2 driver only requires that libbarrett can communicate through the configured CAN interface.

Optional Examples

The top-level build does not compile examples by default. Build individual example targets when needed:

cd build
cmake --build . --target ex04_display_basic_info -- -j$(nproc)
cmake --build . --target ex03_simple_move -- -j$(nproc)

Run hardware-moving examples only when the WAM is clear, supervised, and ready to E-stop.

Optional Sandbox Tools

The sandbox/ directory contains Barrett diagnostic and experimental programs, including CAN terminals, puck tools, WAM examples, hand examples, and encoder utilities. These programs are useful for debugging but are not required by the ROS 2 driver.

The sandbox is included by CMake as EXCLUDE_FROM_ALL, so it is not built by a normal cmake --build . command. Build selected tools manually:

cd build
cmake --build . --target can_terminal puck_terminal high_level_wam -- -j$(nproc)

Safety note: some sandbox programs can move the WAM, modify low-level puck state, or change calibration-related values. Read the source before running a sandbox executable on hardware.

ROS 2 Humble Integration

After installing this library, build the ROS 2 WAM driver in a separate workspace:

cd ~/barrett-wam-ros2-humble
source /opt/ros/humble/setup.bash
colcon build --symlink-install
source install/setup.bash

Launch the WAM node:

ros2 launch wam_node wam_node.launch.py

The WAM node should prompt for the standard Barrett bring-up sequence:

>>> Please Shift-idle the WAM.
>>> The WAM needs to be zeroed. Please move it to its home position, then press [Enter].

After the node starts, verify ROS graph visibility:

ros2 node list
ros2 topic list -t
ros2 service list -t

Expected services include:

/wam/joint_move
/wam/go_home
/wam/gravity_comp
/wam/hold_joint_pos

First Hardware Check

Before commanding motion from ROS 2:

  1. Make sure the WAM workspace is clear.
  2. Keep one hand near the physical E-stop.
  3. Confirm can0 is up.
  4. Start the ROS 2 WAM node.
  5. Shift-idle the WAM when prompted.
  6. Zero the WAM at the correct home pose.
  7. Confirm /wam/joint_states is publishing.
  8. Enable or confirm gravity compensation before sending joint moves.

For a 7-DOF WAM, joint commands must contain exactly seven values in radians.

Example:

ros2 service call /wam/joint_move wam_srvs/srv/JointMove \
  "{joints: [0.0, -2.0, 0.0, 3.13, 0.0, 0.0, 0.0]}"

Use small, supervised motions first. The all-zero pose and the WAM's physical home pose are not the same configuration.

Troubleshooting

cannot find -lstdc++

Your compiler toolchain is incomplete. Install the standard C++ toolchain:

sudo apt install -y build-essential g++

Then delete the old build directory and configure again.

libconfig::Setting has no member named getCSetting

This is the main Ubuntu 22.04 libconfig++ compatibility issue fixed by this fork. Make sure you are building this patched source tree, not the unmodified upstream source.

ROS 2 node links against the wrong libbarrett

Check which library is loaded:

ldd install/wam_node/lib/wam_node/wam_node | grep barrett

If your ROS 2 workspace uses a custom install base, replace install/ with the actual install directory, for example install_ros2/.

If it does not point to /usr/local/lib/libbarrett.so.3.0, reinstall this fork:

cd build
sudo cmake --build . --target install
sudo ldconfig

BusManager::storeMessage: Buffer overflow

This fork increases the CAN message buffer and drops the oldest queued message instead of aborting the process. If you still see CAN overflow symptoms:

sudo ip link set can0 down
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 txqueuelen 1000
sudo ip link set can0 up

Then power-cycle or reinitialize the WAM according to your lab's hardware procedure.

WAM shakes or behaves unexpectedly

Stop motion immediately. Common causes are:

  • gravity compensation is disabled,
  • the WAM was zeroed in the wrong pose,
  • stale configuration files exist in ~/.barrett,
  • the wrong libbarrett.so is being loaded,
  • CAN communication is unstable,
  • commanded joint values are too aggressive.

Recover conservatively: E-stop if needed, kill the ROS 2 node, reset CAN, restart the node, Shift-idle, zero at the correct home pose, then test with a very small joint motion.

Publishing This Fork

When publishing this fork on GitHub, include source/configuration files such as:

include/
src/
config/
examples/
sandbox/
programs/
tests/
cmake/
scripts/
CMakeLists.txt
README.md
COPYING.txt
COLCON_IGNORE

Do not publish generated files:

build/
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
Makefile
install_manifest.txt
*.o
*.so
*.a
core

License and Attribution

This project is based on Barrett Technology's libbarrett. Preserve the original copyright and license notices when redistributing this fork.

See COPYING.txt for license details.

Citation

If this fork supports an academic project, please cite the corresponding ROS 2 WAM driver repository and acknowledge Barrett Technology's original libbarrett software.

About

📚libbarrett for WAM robot arm in ROS2 Humble in Ubuntu 22.04🦾

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors