Category Archives: ROS

First experiences with the ROS Unified Robot Description Format

The Unified Robot Description Format is a nice way to describe robots in ROS. It is a xml formatted file which contains robot related information like links – geometry figures such as boxes, cylinders or sketch-up models(!), Joints – the information how the links are connected to each other, e.g. if they are fixed or continuous and in which state they are (using tf, the ROS transformation package)  – and a lot of more stuff I didn’t figure out after a day with .urdf.
There also is some macro language called xacro, which seams to be pretty amazing, reducing xml code length, enable the usage of variables in it (like for scaling a whole bot) and much more.

it may look simple, but this little robot took a complete evening. He has 2 movable wheels in the front, custom colors and hopefully will drive around in simulation soon:

ScreenshotAmosero_1 ScreenshotAmosero

It’s possible to generate a graphiz dot graph and a pdf from the urdf using following command:

urdf_to_graphiz path/to/file.urdf

after that open it e.g. by

evince file.urdf

looks like that:ScreenshotAmosero_2

Arduino Micro /Leonardo and rosserial Hello World possible link problem?

Yesterday I’ve had to learn something the hard way. Please have a look at the following code of the rosserial “hello world” arduino example:

/*
 * rosserial Publisher Example
 * Prints "hello world!"
 */

#include <ros.h>
#include <std_msgs/String.h>

ros::NodeHandle  nh;

std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);

char hello[13] = "hello world!";

void setup()
{
  nh.initNode();
  nh.advertise(chatter);
}

void loop()
{
  str_msg.data = hello;
  chatter.publish( &str_msg );
  nh.spinOnce();
  delay(1000);
}

Nothing special, right? So compiling it – uploading everything on the arduino works like a charm.

But starting it  rosrun rosserial_python serial_node.py /dev/ttyACM0 crashes with:

rosrun rosserial_python serial_node.py /dev/ttyACM0
[INFO] [WallTime: 1400737593.278250] ROS Serial Python Node
[INFO] [WallTime: 1400737595.610358] Connecting to /dev/ttyACM0 at 57600 baud
/home/yourUser/catkin_ws/src/rosserial/rosserial_python/src/rosserial_python/SerialClient.py:317: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
  self.pub_diagnostics = rospy.Publisher('/diagnostics', diagnostic_msgs.msg.DiagnosticArray)
[ERROR] [WallTime: 1400737595.826375] Error opening serial: could not open port /dev/ttyACM0: [Errno 13] Permission denied: '/dev/ttyACM0'

which can be easily explained by normal users missing permission to access the /dev/ttyACM0. So I advice running it as root, which leads you to customize roots .bashrc including the source /home/yourUser/yourWorkspacePath/devel/setup.bash and the environment variables like ROS_HOSTNAME and ROS_MASTER.

So after that, running it again with root permissions, you’ll get another error message:

[INFO] [WallTime: 1400737809.741920] ROS Serial Python Node
[INFO] [WallTime: 1400737810.415142] Connecting to /dev/ttyACM0 at 57600 baud
/home/yourUser/catkin_ws/src/rosserial/rosserial_python/src/rosserial_python/SerialClient.py:317: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
  self.pub_diagnostics = rospy.Publisher('/diagnostics', diagnostic_msgs.msg.DiagnosticArray)
[ERROR] [WallTime: 1400737827.716961] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

So – rosserial tries to connect to your /dev/ttyACM0 using 57600 baud and fails. The error message is kind of misleading – of course there is some syncing issue, and it has nothing to do with your ROS version… …but with your arduino!

Since the arduino micro / leonardo uses USB for and its build in serial-controller both for programming and communicating, rosserial needs the information to access the device not in the for arduino usual serial way but with USB. So simply adding

#define USE_USBCON

before the rest of the code, will tell ROS to do so.

 

 

Ultrasonic Sensor HC-SR04 as a ROS Range publisher

I’ve taken a HC-SR04 like shown below and connected it to the CubieTruck as a rosserial publisher.

IMG_20140512_114741

 

Instead a of a simple std_msgs::String str_msg;  I’ve implemented a sensor_msgs::Range range_msg; which after starting the arduino in ros with rosrun rosserial_python serial_node.py /dev/ttyACM0  shows up in rostopic echo /ultrasound like this:

---
header: 
  seq: 136
  stamp: 
    secs: 1400706588
    nsecs: 709593997
  frame_id: ultrasound
radiation_type: 0
field_of_view: 0.10000000149
min_range: 0.0
max_range: 4.0
range: 1.18762886524
---

So with that, its possible to visualize everything using rqt_plot:

ScreenshotROSUltraSound

which is pretty nice for my first arduino micro ros project and less than an two hours of work 🙂

For further information see here

 

ROS DepthCloud processing distributed

Today I achieved the following setup by dividing my openni2_launch files into two separate launchers beeing executed on two different machines: one for processing (nodelet_managing) running at a powerful server and one for streaming the [amazon &title=Xtion&text=Asus Xtion]-Image data from the [amazon &title=CubieTruck&text=CubieTruck] to the /camera -topic namespace. After that I could visualize, what my laptop wasn’t able to do before: a 3D DepthCloud with RGB-Data coloring in rviz. It has a native resolution of 640*480 and looks like that:

my first ROS 3D DepthCloud

I can’t say how efficient the load is balanced right now – because I am currently still optimizing.

 

Rasberry Pi Robot with ROS, Xtion and working base_controller teleop

Before I dismantle my little [amazon &title=Raspberry Pi&text=Raspberry Pi] Robot #1 , I wanted to have a little video of its base_controller working together with the turtlebot teleop. It uses the geometry/Twist messages to transmit moving information like a lot of ROS Robots do.

Youtube Video

As you see there is a little acceleration control implemented which makes the robot start smoothly and stop after gently after no key is pressed anymore. In case of emergency its possible to hit e.g. the space bar for a instant full stop.

This robot isn’t very fast – but the next one will be. So this was a successful ROS-learning robot which I can recommend to everyone who wants to know how ROS Robots work.
Its a bit hard to get all of the source compiled on the small arm cpu, and there are nearly no precompiled packages – but it takes away all the fear from compiling errors in the future 🙂

 

CubieTruck (CubieBoard 3) unboxing

The CubieTruck (or so called Cubieboard 3) is the third board of CubieTeam. It is a new PCB-Version with a Allwinner A20 Chip, which has also been used in the CubieBoard 2. But now there is more RAM (2GB) and onBoard VGA-graphics Controller, onBoard Wifi (!) and BLuetooth. There are some more features mentioned below, but for my project the main advantages are: more processing power (2 stronger cores), lower power consumption (500mAh at 5V), lots of GPIOs (2mm!) and flash memory.

So I unboxed one today:

It came with an android os flashed. So after some reading and kinda confusing tutorials I managed to get the correct version 13.04 of lubuntu server running on a sd card, installed ROS on it and was faced with some kind of paradies of ros hydro armhf packages!
Something I was really missing at the [amazon &title=Raspberry Pi&text=Raspberry Pi].

So after the first day of CubieBoard I am really looking forward to get this little fellow beeing the heart of my ROS Robot.

Features:

  • Allwinner Tech A20 SOC
  • SATA supported
  • 54 extended pins
  • Built-in HDMI/ VGA display interface
  • Built-in WIFI+BT module
  • 2GB DDR3 RAM
  • Built-in IR receiver
  • SPDIF audio interface

Specifications:

  • Allwinner Tech SOC A20 ARM® Cortex™-A7 Dual-Core ARM® Mali400 MP2 Complies with OpenGL ES 2.0/1.1
  • 2GB DDR3@480MHz
  • HDMI&VGA 1080P display output on-board
  • 10M/100M/1G Ethernet
  • WIFI + BT wireless connection with antenna on-board
  • SATA 2.0 interface support 2.5’ HDD (for 3.5’ HDD, only need another 12V power input)
  • Storage solution NAND + MicroSD
  • 2 x USB HOST, 1 x OTG, 1 x SPDIF, 1 x IR, 4 x LEDs, 1 x Headphone, 3 x Keys
  • Power DC5V@2.5A with HDD support Li-battery & RTC
  • 54 extended pins including I2S, I2C, SPI, CVBS, LRADC x2,UART, PS2, PWM x2, TS/CSI, IRDA, LINEIN&FMIN&MICIN, TVIN x4 with 2.0 pitch connectors
  • PCB size 11cm *8cm*1.4mm

ROS hydro materials to start

ROS is the Robot Operating System. Its really helpful for everyone who doesn’t want to reinvent the wheel when it comes to robotics.

In my opinion its a bit hard to have a start, and its easy to get confused because of the changes they did between multiple ROS versions.

Some  stuff I can recommend:

  • ROS Wiki
  • ROS Cheat Sheet for Hydro PDF made by clearpathrobotics
  • ‘A Gentle Introduction to ROS’ by Jason M. O’Kane PDF Website
  • ‘Learning ROS for Robotics Programming’ by Aaron Martinez and Enrique Fernandez

Promising but not yet read:

  • ‘ROS by Example’ by R. Patrick Goebel Website