Lab 5: A basic office assistant
The goal of this lab is to provide the basic structure of the group work. In this lab, you will create a basic robot that fulfills the goals of an office assistant:
- Create a
text_to_goals
node that converts a text command into a goal request. It should listen to a string and output a set of goals. - Create a
decision
node, it takes the set of goals and request execution of TST by thetst_executor
of Lab3.
You should create a new package air_lab5
, you should check Lab2 or Lab3 for how to create a package.
New map and database of points
For this lab we use a different map, that simulates an office environment, and it looks like this:
To load that world in the simulator you should use the following command:
ros2 launch air_bringup turtle.launch.py world:=office_1
Ideally, your robot should explore that environment to extract all the interesting points. You will have to do that in the project phase, but for this lab we provide you with the approximate ground truth (i.e., the position of humans will be in the office where the human is but not exactly at the human's position - red dot in the map). You can generate a turtle
file to insert the data in the database with:
ros2 run air_simple_sim generate_rdf office_1
You will notice that we have more object classes, such as office
or vendingmachine
. Additionally, objects have tags
that indicate the name of a person or the content of the vending machine.
To insert the file in the database, simply run:
ros2 service call /kdb_server/insert_triples ros_kdb_interfaces/srv/InsertTriples "
graphname: 'semanticobject'
format: 'ttl'
content: '`ros2 run air_simple_sim generate_rdf office_1`'"
Goal Message
In your air_lab_interfaces
, you should add two new messages ``Goaland
Goals`. They will be used to communicate goals between `text_to_goals` and `decision`. You can check the official tutorial to know how to create custom messages.
Goal
should have the following fields:
-
type
(string
) the type of goal with possible valuesgoto
,bring
,explore
... -
object
(string
) the object, can be empty, or for example, forbring
goal type it could be coffee, sandwich... -
destination
(string
) the destination of the goal, or who to bring theobject
to,...
Goals
should have the following field:
-
goals
(list ofGoal
) a list of goals.
Note that in this lab, we use a single Goal
but it may be that for your project you will want to handle multiple goals.
Text Command Node
This node should listen to a topic called text_command
of type std_msgs/string
, parse the commands and output a set of goals on a topic called goals_requests
of type air_lab_interfaces/Goals
.
Examples of text commands:
- "Goto George" this should lead to a
Goal
with field{ type: "goto", destination: "George" }
- "Bring Coffee" this should lead to a
Goal
with field{ type: "bring", object: "Coffee", destination: "User" }
. In this case you can assume that user is at the current robot position. - "Explore!" this should lead to a
Goal
with field{ type: "explore" }
You can use ros2 topic
to publish the text command.
Decision Node
This node should listen to the topic goals_requests
and generate TSTs as a file (like you did in Lab4). Then you should start the execution of the TST from your decision node. You should query the database for destination, using the tags
. You should look at the data that was inserted in the database, and you should extend the queries of Lab4
to include this tag.
Demonstration
- Use the following command:
- "Goto Annika" should make the robot go to Annika's office
- "Bring Coffee" should make the robot go to a vending machine with coffee and bring it back
- "Explore!" should make the robot start random exploration