A maintained Ubuntu 22.04-compatible build of Barrett Technology's
libbarrettfor controlling the Barrett WAM and BarrettHand from modern Linux systems, including ROS 2 Humble workstations.
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.
- đź§© 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_IGNOREmarker 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.
| 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.
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 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-devPython 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.
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 ldconfigThe default install location is /usr/local. After installation, the library
should be visible to the dynamic linker:
ldconfig -p | grep libbarrettExpected result:
libbarrett.so.3.0 (...) => /usr/local/lib/libbarrett.so.3.0
During installation, libbarrett installs robot configuration files to:
/etc/barrett/
Check that the directory exists:
ls /etc/barrettTypical 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.
Most ROS 2 WAM deployments use Linux SocketCAN. Confirm that your CAN device is present:
ip linkBring 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 upVerify that CAN traffic is visible when the WAM is powered and connected:
candump can0If 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.
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.
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.
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.bashLaunch the WAM node:
ros2 launch wam_node wam_node.launch.pyThe 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 -tExpected services include:
/wam/joint_move
/wam/go_home
/wam/gravity_comp
/wam/hold_joint_pos
Before commanding motion from ROS 2:
- Make sure the WAM workspace is clear.
- Keep one hand near the physical E-stop.
- Confirm
can0is up. - Start the ROS 2 WAM node.
- Shift-idle the WAM when prompted.
- Zero the WAM at the correct home pose.
- Confirm
/wam/joint_statesis publishing. - 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.
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.
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.
Check which library is loaded:
ldd install/wam_node/lib/wam_node/wam_node | grep barrettIf 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 ldconfigThis 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 upThen power-cycle or reinitialize the WAM according to your lab's hardware procedure.
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.sois 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.
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
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.
If this fork supports an academic project, please cite the corresponding ROS 2
WAM driver repository and acknowledge Barrett Technology's original
libbarrett software.