rostest – Lessons Learned

I’ve been trying to add code and interface level tests to ROSOSC lately, and I thought I would take some time to document my lessons learned.

Background

rostest, and it’s sister stack rosunit, can be used to implement interface and code level tests, respectively.  rosunit is useful for putting already-existing (hopefully) unit tests into the greater rosbuild framework, so that these test can be run either via the rosunit command line utility, or through the rosbuild system.

Read More

ROS to Open Sound Control Bridge

I am please to announce a new stack that I’ve been working on: ROSOSC.  Code and documentation for my “beta” release are available immediately on the ROS.org wiki: http://www.ros.org/wiki/rososc

ROSOSC is a set of utilities and nodes for interacting with Open Sound Control hardware and software devices.
One of the main features is the ability to interact with TouchOSC (created by hexler: http://hexler.net), the iOS application, to create dynamic, touch-interactive, control surfaces that can be used with ROS.  These control surfaces can be composed of several different types of controls, such as push buttons, toggle buttons, faders, rotary knobs, labels and LEDs.  Most of the controls support two-way communication with ROS, which allows users to change color, position, size, and visibility of all of the controls on the page via ROS topics.
There are two main ways of interacting with TouchOSC with ROS:
  • Using a “default handler” – Simply create a layout file in the freely available TouchOSC editor, and then launch the ROS touchosc_bridge node.  All of the controls on the page will show up as topics that can be published to/subscribed to using ROS.
  • Using a “tabpage handler” – Users can also create a python module that can directly interface with OSC clients.  There are many features available to developers, including multiple client support, client join/quit callbacks, and client tabpage switching callbacks.  More can be found out on the wiki and API documents.
    • API Docs are available on the ROS wiki
    • Two tabpage handlers are included out of the box:
      • Diagnostics_handler – a tabpage for viewing diagnostics and aggregate diagnostics data
      • teleop_handler – a tabpage for broadcasting command velocity messages to holonomic and differential drive robots.
I hope that you find this useful in your robotics projects, and I’m excited to see some of the future uses of the TouchOSC and Open Sound Control interfaces.
To get an idea of the basic features, I have made some YouTube videos:

pr2_computer_monitor with lm_sensors

Currently, the pr2_computer_monitor stack uses the IPMI interface for monitoring hardware status.  Since not everyone can get a computer with these capabilities, I decided to create a simple parser for the lm_sensors package in Linux.

lm_sensors allows the user to get basic system information such as voltages, temperatures, and fan speeds from the SMBus and I2C controllers that are built into motherboards.

Here is an example of the output of the ‘sensors’ command, once lm_sensors has been properly configured for your system.

atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage:       +1.14 V  (min =  +0.80 V, max =  +1.60 V)
 +3.3 Voltage:       +3.28 V  (min =  +2.97 V, max =  +3.63 V)
 +5 Voltage:         +5.09 V  (min =  +4.50 V, max =  +5.50 V)
 +12 Voltage:       +12.15 V  (min = +10.20 V, max = +13.80 V)
CPU FAN Speed:      1875 RPM  (min =  600 RPM)
CHASSIS FAN 1 Speed: 629 RPM  (min =  600 RPM)
CHASSIS2 FAN Speed:  649 RPM  (min =  600 RPM)
POWER FAN Speed:       0 RPM  (min =  600 RPM)
CPU Temperature:     +41.0°C  (high = +60.0°C, crit = +95.0°C)
MB Temperature:      +43.0°C  (high = +45.0°C, crit = +95.0°C)  

coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +51.0°C  (high = +80.0°C, crit = +100.0°C)  

coretemp-isa-0001
Adapter: ISA adapter
Core 1:      +50.0°C  (high = +80.0°C, crit = +100.0°C)  

coretemp-isa-0002
Adapter: ISA adapter
Core 2:      +41.0°C  (high = +80.0°C, crit = +100.0°C)  

coretemp-isa-0003
Adapter: ISA adapter
Core 3:      +59.0°C  (high = +80.0°C, crit = +100.0°C)

And here is a screenshot of the sensors in Runtime Monitor on ROS.

My code is available in my personal ROS stack on GitHub.  Feel free to check it out.

Lawnmower Updates

20110916-090059.jpg

20110916-090111.jpg

ELEC2120 MATLAB In-class #1

Getting Started with MATLAB

MATLAB is installed on all Auburn College of Engineering computers.  Student licenses can also be purchased from the bookstore for home use.  It is supported on Windows, Linux and Macintosh computers.

MATLAB can be used in two main ways, interactively and scripted.  Interactive mode is much like using a graphing calculator where the user inputs commands and MATLAB runs the commands instantly.  Scripted mode is used by going to “File > New > Script” and entering commands there.

MATLAB In-Class

Here is an example of how to do problem 1:
pr1_1_i_d.m

Here is an example function:

?View Code MATLAB
function u_t = unitstep( t, tau )
%UNITSTEP Creates a unit step output given a range input
 
    % Multiply by a double so that the answer will be a double.
    u_t = 1.0 * (t >= tau);
end

MATLAB Tips

Clear Early

At the beginning of your files, you may find it helpful to use the following commands to clean up your workspace.

?View Code MATLAB
close all;         % Close all figure windows
clear;             % Clears all variables in the workspace
clc;               % Clears the console

 

Cell Mode

Using MATLAB’s built in Cell Mode (YouTube Tutorial) can make documentation and debugging much easier.

An example of using cells can be found here:
pr1_1_i_d.m

Cells are marked with the double-percent sign (%%). Each cell will execute independently when Ctrl+Enter is pressed.

Commonly Used Plotting Tools

?View Code MATLAB
figure();                    % Creates a new figure
 
plot(x,y);                   % Creates a plot of x vs y
stem(x,y);                   % Creates a stem-plot of x vs y
 
xlabel('t (s)');             % Label the x-axis
ylabel('x(t)');              % Label the y-axis
title('1.1.ii.c');           % Set the Title of your plot
title(sprintf('deltaT = %8.3f',deltaT))   % Title with string substitution
grid on;                     % Turn on a background grid
axis equal;                  % Sets tick marks to be even on x and y axis
axis square;                 % Makes the current axis box square (cannot be used with axis equal.)

Publishing

A commonly-overlooked feature of MATLAB is the publishing feature. This allows you to publish any m-file in cell mode to a pdf, latex, or word document easily.

The settings can be accessed in the editor window by going to File > Publish Configuration, and then publish the file by going to File > Publish.

Here is an example of a published file (PDF): pr1_1_i_d.pdf
And another example of my custom LaTeX export: pr1_1_i_d

Getting Help with MATLAB

Outside MATLAB

Within MATLAB

help

The “help” command at the command window interface to MATLAB will return basic text-only help documentation for the function in question.

?View Code MATLAB
>> help eye
 EYE Identity matrix.
    EYE(N) is the N-by-N identity matrix.
 
    EYE(M,N) or EYE([M,N]) is an M-by-N matrix with 1's on
    the diagonal and zeros elsewhere.
 
    EYE(SIZE(A)) is the same size as A.
 
    EYE with no arguments is the scalar 1.
 
    EYE(M,N,CLASSNAME) or EYE([M,N],CLASSNAME) is an M-by-N matrix with 1's
    of class CLASSNAME on the diagonal and zeros elsewhere.
 
    Note: The size inputs M and N should be nonnegative integers. 
    Negative integers are treated as 0.
 
    Example:
       x = eye(2,3,'int8');
 
    See also speye, ones, zeros, rand, randn.
 
    Overloaded methods:
       distributed/eye
       codistributor2dbc/eye
       codistributor1d/eye
       codistributed/eye
 
    Reference page in Help browser
       doc eye

doc

The “doc” command at the command window interface will return the MATLAB rich-text documentation for the function in question.

“doc eye” returns Mathworks Documentation

lookfor

The “lookfor” command at the command window interface will search for functions matching a string.

?View Code MATLAB
>> lookfor identity
eye                            - Identity matrix.
speye                          - Sparse identity matrix.