0
$\begingroup$

Rosanswers logo

Hi,

After some time trying to find a way to simplify this code in the tutorials of simple publisher, that uses a string and turn it into a twist message but I couldn't. Here's my last effort on it.

That's why I ended up creating a modification of some of the codes that I found. Here is the subscriber and here is the publisher. I got it working, and now I ask myself: Is using tf necessary if the only thing I need is to send and receive data? (cmd_vel for the moment, although later laser_scan info, too). How can it be done? I'm at a loss here, don't know where to go from here (read a lot of documentation and finished the tutorials a couple of times)

Thanks,

Update: Awesome! I got the publisher running, but the subscriber (code here) is giving me some weird compilation problems: here.

@Lorenzo Riano: My basic concern was getting to work a code that sends some sort of speed information. Once that works, my next step is writing something similar with laser_scan. Ultimately, when I get speed control and laser_scan working, I plan to play with it and make a robot move around randomly in a .world map in Stage. So, basically, it all is for simulating it with stage, no real robot involved for now.

@Everybody: What's the best way to showcase that a publisher+subscriber works? Just by printing the message on screen once it gets to the subscriber? What if they don't fully work? Some sort of debugging available?


Originally posted by jlo on ROS Answers with karma: 385 on 2011-11-22

Post score: 2


Original comments

Comment by Lorenzo Riano on 2011-11-24:
rxconsole is your friend here :-)

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

No, TF is not necessary to do what you want. I tried your "last publisher" example (the first pastebin link), and here's what's necessary to get it running:

  • comment the include of "geometry_msgs/Twist.h" back in (it's commented out)
  • make sure that your manifest.xml contains the line <depend package="geometry_msgs"/>
  • make sure that your CMakeLists.txt contains something like this: rosbuild_add_executable(twist_publisher src/twist_publisher.cpp)

Originally posted by Martin Günther with karma: 11816 on 2011-11-22

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$
0
$\begingroup$

Rosanswers logo

My understanding is that you are calculating the robot's movements when a constant speed is applied, using a unicycle model. The short answer is therefore "yes, you need to publish a tf::TransformBroadcaster in order to keep track of the robot's position".

The long answer depends on what your goal is. If you are writing a driver for a robot that reads the odometry and the velocity commands and outputs the current position, then you probably need to read this data from the hardware (wheel encorders?). If you are writing a simple simulator then this is the right path to go.

If you are familiar with Player/Stage, then here is an example of player-ros bridge that deals with transformations and publishes odometry.

Could you please describe the problems you are having, if any?


Originally posted by Lorenzo Riano with karma: 1342 on 2011-11-22

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by jlo on 2011-11-24:
Maybe putting the link like this (directly pasting it)? https://github.com/cburbridge/uuisrc-ros-pkg/blob/master/uu-robots/player_interface/src/ros_player.cpp

Comment by Lorenzo Riano on 2011-11-24:
I don't why adding a link on the wiki doesn't work. The preview in the editor is fine! Any suggestion?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.