miércoles, 11 de agosto de 2010

Understanding how tf is generated

First of all consult this Tutorial: Introduction to tf

Here you can see how to use these basic tf tools:

> view_frames: creates a diagram of the frames being broadcast by tf over ROS.

$ rosrun tf view_frames

Here a tf listener is listening to the frames that are being broadcast over ROS and drawing a tree of how the frames are connected. To view the tree:

$ evince frames.pdf


This is an example of the tf tree of the activity of the first ticket of Assembla in the projecto of SSC-ITESM.

If you know the frames involved, you can ask tf_echo to report the transform between any two frames broadcast over ROS.

Usage:

rosrun tf tf_echo [reference_frame] [target_frame]

"Let's look at the transform of the turtle2 frame with respect to turtle1 frame which is equivalent to \large{$$\mathbf{T}_{turtle1\_turtle2} =\mathbf{T}_{turtle1\_world} *\mathbf{T}_{world\_turtle2}$$} :

$ rosrun tf tf_echo turtle1 turtle2

------

Next I read this Tutorial "Leraning tf" all in cpp: Learning tf

1) Writing a tf broadcaster (C++):

martes, 10 de agosto de 2010

Functionality of the topics used in do-slam-navigation.launch

1) Run do-slam-navigation.launch

roslaunch launch/do-slam-navigation.launch

2) In a new terminal run rxgraph.

The nodes involved when launching do-slam-navigation.launch are the following:

/amcl
/Gmapping
/move_base_node
/Stage_Sim
/Teleop_Base
/TF_Broadcaster
/rosout

We can see how nodes communicate each other by messages through topics with the following diagram (rxgraph):



3) We can see using rxgraph to wich topic each node sobscribes or publishes. Fow example if we click on the node /Stage_Sim we get this info:

Node [/Stage_Sim]
Publications:
* /base_scan [sensor_msgs/LaserScan]
* /rosout [roslib/Log]
* /tf [tf/tfMessage]
* /clock [roslib/Clock]
* /odom [nav_msgs/Odometry]
* /base_pose_ground_truth [nav_msgs/Odometry]

Subscriptions:
* /clock [roslib/Clock]
* /cmd_vel [geometry_msgs/Twist]

Services:
* /Stage_Sim/set_logger_level
* /Stage_Sim/get_loggers
Pid: 14092
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound
* transport: TCPROS
* topic: /tf
* to: /Gmapping
* direction: outbound
* transport: TCPROS
* topic: /tf
* to: /move_base_node
* direction: outbound
* transport: TCPROS
* topic: /tf
* to: /amcl
* direction: outbound
* transport: TCPROS
* topic: /base_scan
* to: /move_base_node
* direction: outbound
* transport: TCPROS
* topic: /clock
* to: /Stage_Sim
* direction: outbound
* transport: INTRAPROCESS
* topic: /clock
* to: /Gmapping
* direction: outbound
* transport: TCPROS
* topic: /clock
* to: /TF_Broadcaster
* direction: outbound
* transport: TCPROS
* topic: /clock
* to: /move_base_node
* direction: outbound
* transport: TCPROS
* topic: /clock
* to: /amcl
* direction: outbound
* transport: TCPROS
* topic: /clock
* to: /Teleop_Base
* direction: outbound
* transport: TCPROS
* topic: /clock
* to: http://oscar-laptop:56712/
* direction: inbound
* transport: INTRAPROCESS
* topic: /cmd_vel
* to: http://oscar-laptop:45548/
* direction: inbound
* transport: TCPROS
* topic: /cmd_vel
* to: http://oscar-laptop:58957/
* direction: inbound
* transport: TCPROS


Then we can see that it publishes in these topics:

* /base_scan [sensor_msgs/LaserScan]
* /rosout [roslib/Log]
* /tf [tf/tfMessage]
* /clock [roslib/Clock]
* /odom [nav_msgs/Odometry]
* /base_pose_ground_truth [nav_msgs/Odometry]

And subscribes to these other topics:
* /clock [roslib/Clock]
* /cmd_vel [geometry_msgs/Twist]

-----

As seen on the rxgraph the topics involved are:

/clock "It is used to published simulated time within a runtime system."
/tf "Current transform tree. This is the normal /tf topic."
/map "Get the map data from this topic, which is latched, and updated periodically."
/cmd_vel "velocity commands to differentially drive the position of the robot."
/rosout "Standard ROS topic for publishing logging messages."
/base_scan

lunes, 9 de agosto de 2010

How to know to wich topic a node subscribes or publishes

We can know to wich topic a node subscribes or publishes by viewing carefully the .cpp file of the node. Along the code you can find the name of the topic to which the node subscribes or publish, for example:

ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);

In this line you can see that the node publishes to the "chatter" topic, and that the message is of the type of std_msgs/String

ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);

In this other example you can see that the node subscribes to the "chatter" topic.

For more information: Writing a Simple Publisher and Subscriber (C++)

Launch File Configuration - Tag Reference

The launch file is an XML code that describes how the nodes of a package are configured. It consists of the following tags (Not all of them are always necessary):

<launch>
It is used as a container of the other tags. It is the root element of any roslaunch file. As any XML file it starts with and ends with . In this case this tag is always at the beginning and the end of every launch file.

<node>
The node tag specifies a node that you want to have launched. It brings up and takes down nodes.

Note: "roslaunch does not provide any guarantees about what order nodes start in. This is intentional: there is no way to externally know when a node is fully initialized, so all code that is launched must be robust to launching in any order"


<machine>
This tag declares a machine that runs ROS nodes on. "It is mainly used to declare SSH and ROS environment variable settings for remote machines".

Attributes:
name, address, ros-root, ros-package-path, default, user, password and timeout.

It's only Element is: env.

More info about this tag in:
Note: "You do not need this tag if you are launching all the nodes locally"

<include>
This tag allows you to include another roslaunch file into your current file.

Attributes: file, ns, clear_params.

More info about this tag in: <include>

<remap>
"The tag allows you to pass in name remapping arguments to the ROS node that you are launching in a more structured manner than setting the args attribute of a directly"

Attributes:
from, to.

More info about this tag in:

<env>
This tag allows you to set environment variables on nodes that are launched in the XML file.

Attributes:
name, value.

More info about this tag in:

<param>
Instead of a value you can specify a textfile or binfile attribute to set the value of a parameter to be set on the Parameter Server.

Attributes:
name, value, type, textfile, binfile, command.

More info about this tag in:

<rosparam>
"The tag enables the use of rosparam YAML files for loading and dumping parameters from the ROS Parameter Server. It can also be used to remove parameters."

Attributes:
command, file, param and ns.

More info about this tag in:

Note: The attribute ns is deprecated.

<group>
With this tag you can apply settings to a defined group of nodes.

Attributes:
ns, clear_params.

More info about this tag in:

<test>
This node is like a tag, but the difference is that it refers to a test node.

More info about this tag in:

<arg>
"The tag allows you to create more re-usable and configurable launch files by specifying values that are passed via the command-line, passing in via an , or declared for higher-level files."

More info about this tag in:

---

Key Concepts:

Parameter Server: "A parameter server is a shared, multi-variate dictionary that is accessible via network APIs. Nodes use this server to store and retrieve parameters at runtime. As it is not designed for high-performance, it is best used for static, non-binary data such as configuration parameters. It is meant to be globally viewable so that tools can easily inspect the configuration state of the system and modify if necessary. "

---

More information available at: ROSLAUNCH/XML
The examples showed in this post are from the same link.

Also if you need to learn XML you can use this free tutorial: XML Tutorial

rviz Main Configuration Elements

rviz

This is how the dashboard looks:



It's main components are:

Displays:
This are the different options to visualize the information obtained from the laser, the sonar, the camera, the encoders etc. any sensor that ROS can read. Also we can display different marks or grids to make ouy visualization easier.

These are some of the displays we can activate:

Axes, camera, grid, grid cells, laser scan, map, markers, path, pose, pose array, point cloud, polygon, odometry, robot model, tf.

They are fully explain on the USER'S GUIDE



Coordinate frames: rviz uses tf transform system to for transforming data from the coordinate frame it arrives into a global reference frame.





Tools:
> Move Camera
> Select parts of the 3D Robot



> Navigation Goal
> Estimate the 2D pose

Tool properties:



Time: "It allows you to see how much ROS Time time has passed, vs. how much "Wall Clock" (aka real) time has passed."



Plugins: Thera are some plugins that can be added to rviz. They can be installed in the plugins->manage.

This info is taked from the User's guide or ROS.org in:
rviz USER GUIDE

Yaw, Pitch and Roll

tf view_frames and tf_echo

These are two of the basic tools to use:

> view_frames: This tool creates a diagram of frames that are being broadcast by tf over ROS.

$ rosrun tf view_frames

It draws a tree of how the frames are connected, to see it use the next command:

$ evince frames.pdf

> tf_echo

tf_echo reports a transform between two frames broadcast over ROS. To use it you need to specify both frames in the command line.

like this:

rosrun tf tf_echo [reference_frame] [target_frame]