Wiki

Clone wiki

scl-manips-v2 / barrett / wam_operation

This page documents how to control the Barrett WAM arm from SCL.

Setting up libbarrett

  • You first need the WAM control drivers. These are provided by Barrett in the libbarrett software package.
    • Download libarrett from here.
    • Manips lab : Note that there is a lab computer already set up with libbarrett for you to use.
  • If you want to set up a different computer like your laptop to control the WAM directly, you will have to go through the process of setting up libbarrett.
  • You can choose to either build in realtime mode using the Xenomai framework, or (preferably) build with stock Ubuntu in non-realtime mode.
    • For Xenomai, follow the instructions on the WAM Wiki.
    • For stock Ubuntu, follow the instructions in this document.

NOTE: If you set this up on a new computer you may have to flip a sign for joint 4 in the libbarrett spec file in /etc/barrett/. Ask Mohi.

Using libbarrett

If you've completed the setup successfully, you should be able to run the ex04 example provided with libbarrett and read the data as you move the robot. You should also know how to calibrate and zero the robot.

At this point, you're free to use the examples to write your own program that interfaces with the WAM based on the many examples provided with libbarrett. You can use the Programming Manual to help you out.

If you're using this within SCL, you'll probably want to skip all the high-level features of the WAM and just read joint positions/velocities and command torques in time with the libbarrett control loop (500 Hz by default).

Redis driver

There is also a driver available that lets you use Redis to communicate with the WAM. It is also provided on the lab machine. It allows you to make your controller control the WAM using a sensors and actuators channel of the pub/sub feature in Redis. It can make it significantly easier for you to do complex things with the WAM. The source of the driver is located here.

NOTE: The setup for the driver is not fully documented yet, but is not hard. The only obscure thing is that the libbarrett headers must be C++11 compatible, for which I had to change all "static const double" variable declarations to "static constexpr double".

You can run the driver with: sudo chrt -rr 90 ./wam_redis_driver

You can change the location of the Redis server the driver talks to and the names of the actuator/sensor channels in main.cpp of the driver source, and recompile it with cmake/make.

When the driver is running, you can open the redis-cli and manually subscribe to sensor data or publish actuator data. This is great for debugging or experimentation. When writing a controller, you should use Redox to subscribe to sensor data and publish actuator data. The multi_robot example in applications-web of the feature/nodejs branch of SCL provides a good example (TODO - make this in not such an obscure place).

Example command to read sensor data:

subscribe barrett:wam:sensors

Example driver command to go to a specific joint position:

publish barrett:wam:actuators "{\"q\": [0, -2, 0, 3.14, 0, 0, 0]}"

Example driver command to apply a specific torque:

publish barrett:wam:actuators "{\"tau\": [0, -2, 0, 3.14, 0, 0, 0]}"

Updated