ND - 2. ROS essentials - core

2. ROS essential - core

Fundamental

perception -> decision making -> action

  1. Master = manager; registry of all nodes

  2. Parameter Server = params + configs

  3. Node -> publish -> Topic -> subscribe -> node (named Bus pipeline)

  4. Service = Node1 -> request -> Node2 -> response -> Node1 (1:1)

Q: Is ROS installed & sourced?

A: $ ros with double tab should list lots of commands.

source vs ./

sourceexecute the script in the current session.

./start a new session, with a copy of the current env. When exit the script, all env variables will be lost.

$ source /opt/ros/kinetic/setup.bash

Gazebo = physics simulator,

RViz = can visualize sensor data being published over a ROS topic like camera images, point clouds, Lidar data, etc.

TurtleSim

1. Starting the Master process

  • Naming and registration services to running nodes

  • Facilitating connections between nodes

  • Tracking all publishers and subscriber.

  • Aggregating log messages

2. Node

/rosout Launched by roscore, and subscribes to the /rosout topic, all nodes send log messages to it.

Catkin

1. Create workspace

2. Add a package

From existing code

From scratch

scripts (python executables)

src (C++ source files)

msg (for custom message definitions)

srv (for service message definitions)

include -> headers/libraries that are needed as dependencies

config -> configuration files

launch -> provide a more automated way of starting nodes

Other folders may include

= = =

urdf (Universal Robot Description Files)

meshes (CAD files in .dae (Collada) or .stl (STereoLithography) format)

worlds (XML like files that are used for Gazebo simulation environments)

3. roslaunch

  • Launch ROS Master and multiple nodes with one simple command

  • Set default parameters on the parameter server

4. rosdep

ROS Publishers

Node -> publisher -> topic

  1. allow a node to send messages to a topic

  2. can be either synchronous or asynchronous.

  3. Synchronous publishing - The 2nd publisher is blocked until the 1st publisher has serialized all messages to a buffer and the buffer has written the messages to each of the topic's subscribers.

  4. Asynchronous publishing - store messages in a queue until the messages can be sent. (the oldest messages are dropped when exceeds the size of the queue.)

command line example to publish a message.

publish messages(geometry_msgs/Twist) to topic(cmd_vel)

see realtime msg from a topic

ROS Subscribers

A Subscriber = node to read messages from a topic.

data -> streamed -> node.

ROS Service

node <-> request/response <-> node

Last updated

Was this helpful?