ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

python tutorials for robot setup tf and sensors

asked 2011-04-21 20:53:46 -0500

davo gravatar image


Very new to ROS.....please excuse

core server navigation visualisation etc maverick 2.6.35-28-generic ros-cturtle-core (synaptics version) 1.0.0-s1302849017~maverick

robot node ubuntu-10-04 architecture armel ( beagle board xM ) ros cturtle compiled on board from svn

Outline Was planning to implement ROS via python to data from personal arduino robot. My arduino is working well so I do n't really want to start integrating other's libraries into it at the moment.

Progress Working through the tutorials and most work, transform listener/broadcaster mostly work, but the introductions to time fail.

Now trying to work through the c/cpp tutorials for robot setup and laser sensor.


I really want to work in python if I can, are there tutorials for these or do you have to setup in C and then use python in a restricted manner?



edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2011-04-27 02:23:21 -0500

dornhege gravatar image

The navigation stack setup is basically robot configuration setup, i.e. provide laser, odometry, and especially tf + writing config and launch files for the nav stack. The data can come from any ROS node (i.e. also python), you will just need to publish odometry and tf. The config and launch files are independent of python (or c++).

The navstack tutorials are mostly C++ independent. The example code is in C++ but besides showing you which values to fill, you should be able to do the same things in python.

It might be a good idea to do the python tf tutorials and you should know how to write a broadcaster from the general ROS tutorials.

edit flag offensive delete link more

answered 2011-05-08 20:53:52 -0500

davo gravatar image

Just posting this for those who venture into ROS and Python and got a bit lost like me!

Odometry was fairly simple, but the Laser/PML sensor was a bit more fickle:

I found this:


for which I was very grateful, thanks

PML or poor man's laser a sharp IR range finder in my case:

From the Trossen Forum

Finally, my version of your PML node to simulate the laser scan:

the code block seems to misbehave to scroll down

you might need to add top line...

!/usr/bin/env python


rospy.init_node("base_scan") scanPub = rospy.Publisher('base_scan', LaserScan) scanBroadcaster = TransformBroadcaster()

I got stuck on that....


scan.header.frame_id = "base_link"


The scan.ranges is a list, so you collate the ranges from your sensor, and assign that to scan.ranges

If the min max and inc angles are set properly it works....

You also need a transform

This is commented out in the above code snippet

something like this:

!/usr/bin/env python
import roslib roslib.load_manifest('<your package="" name="">') import rospy import tf

if __name__ == '__main__': rospy.init_node('my_tf_broadcaster') br = tf.TransformBroadcaster() rate = rospy.Rate(10.0) while not rospy.is_shutdown(): br.sendTransform((0.16, 0.0, 0.11), (0.0, 0.0, 0.0, 1.0),, "base_scan", "base_link") print ".",


edit flag offensive delete link more

answered 2011-04-26 23:35:59 -0500

davo gravatar image



Well I found

which is proving to be me a template esp the configuration files and the python examples

Also got some clues on maps etc which solved another question I had from the tutorials

I'm not too daunted by the basic coding it's the configuration...

Put arduino cmdMessenger on as the robot is in bits...wrote a quick simulator on the arduino for movement scans etc that tip saved alot of time

Silly Question

Got some silly questions about the values passed, esp in odometry

dvx dvy.....assuming velocity

but deltas to me can be 2 things

  1. change in values between 2 measured points or
  2. velocity measured at point d1, d2

I am assuming 2.



edit flag offensive delete link more

answered 2011-04-27 16:08:40 -0500

davo gravatar image


thanks I've done alot of the tutorials, in C(++) and python

so I've got to the point of robot setup and making notes on the c++ and trying to abstract to python and custom robot.

From the frameworks I've looked at ROS is way ahead of most in that it installs, documentation is updating and it's there!

Just I have to catch up with what I am trying to implement and there's alot in the detail.

I'll try and write things up as I go.

The good Dr.s work is very helpful like a worked example! the config files etc in the package and as I've found maps, UDRF etc the yaml etc and launch config files so that gives me a really good start.

All those things start to answer the other questions I have.

I live in country australia, so there's not a great deal of peer chat going on it slows things down.

Meanwhile back to learning threading and queues...


edit flag offensive delete link more

Question Tools


Asked: 2011-04-21 20:53:46 -0500

Seen: 2,676 times

Last updated: May 08 '11