Wiki

Clone wiki

scl-manips-v2 / docu / scl-distrib-ctrl

Distributed Control

The advent of transactional RAM-based databases (like Redis) has made it feasible for us to get robust multi-process I/O with a variety of introspection techniques and interfaces to numerous programming languages. Moreover, there seems to be acceptable performance performance and latency.

Along those lines, we have a starter implementation that provides a standardized interface specification and applications to leverage it.

Recommended order to run a distributed app:

  1. Run the visualizer (see below)
  2. Run the controller (see below)
  3. Run the real or simulated robot

Robot Driver Specifications (with Redis I/O)

We expect robot drivers at their very base to communicate generalized coordinates and velocities to Redis, and to accept generalized forces from Redis. We also follow C++ style namespace delimiters to keep things simple.

The bare minimum required is:

Redis Set : Lists all active robots

  sadd scl::robots PumaBot

Redis Keys : Properties for each active robot

  set scl::robot::PumaBot::sensors::q '0 0 0 0 0 0'
  set scl::robot::PumaBot::sensors::dq '0 0 0 0 0 0'
  set scl::robot::PumaBot::actuators::fgc '0 0 0 0 0 0'
  set scl::robot::PumaBot::fgc_command_enabled 1

Optionally, drivers may choose to specify more keys. Though the additional keys should be organized under the given robot's namespace.

Virtual Robot Sim (with Redis I/O)

We have an app that follows the given key specification format. Using the PumaBot as an example, we can run it:

$ cd scl.git/applications-linux/scl_redis_sim
$ sh make_rel.sh
$ ./scl_redis_sim ../../specs/Puma/PumaCfg.xml

If you like, open a redis-cli and run the monitor to see what it does.

Robot Visualizer (with Redis I/O)

We have an app to visualize what the robot (or virtual sim) is doing:

$ cd scl.git/applications-linux/scl_redis_visualizer
$ sh make_rel.sh
$ ./scl_redis_visualizer ../../specs/Puma/PumaCfg.xml

Robot Web Dashboard (with Redis + Webdis I/O)

We also have a web interface to monitor the robot (or virtual sim). Simply go to The SCL Dashboard.

Note that you may have to install webdis etc. There are some instructions at the bottom of the webpage.

Robot Controller (with Redis I/O)

Now you might have noticed the robot flailing around. If you'd like to control it, you can use the redis controller.

$ cd scl.git/applications-linux/scl_redis_ctrl
$ sh make_rel.sh
$ ./scl_redis_ctrl ../../specs/Puma/PumaCfg.xml PumaBot opc hand

And voila, your robot should be controlled. By default, it will take its hand to the starting zero position. To change the desired position:

$ redis-cli
> set scl::robot::PumaBot::traj::xgoal "0.111501 0.340094 0.253085"

Note : You may also have to set an fgc_enabled flag in redis to get the controller to start working. Feel free to change the robot name to your robot, or look for the suitable name using the keys * command.

$ redis-cli
> keys *
> set scl::robot::PumaBot::fgc_command_enabled 1

Note : The robot might have started off in an odd position if you waited too long to start the controller. If so, simply go to the robot sim, press ctrl+c, and re-start it. This also shows that you can turn the controller off/on at any time. You should ideally start the simulator or real-robot last.

Discussion

Doing all of this allows us to shunt the annoying part of control (trajectory planning etc.) on to a different programming language and/or different computer (or whatever). There are a variety of available Redis packages for different languages, which makes things easy.

With time, it is likely we'll support interacting with the entire SCL database via Redis. That will truly make the entire system open and easy to integrate with. So far, the primary cost seems to lie in the string serialization routines. But it is feasible to do that in a distributed manner and so it doesn't seem like a huge deal. Watch this page for more...

As a simple exercise, consider writing a Python program that moves the hand in a sine wave. Or use Matlab to log data and plot some joint angles.

Have fun!

Updated