Lab 4 submission due on Sunday, 23:59
Table of contents
Prelab (1%)
Before lab
- Each student must find and bring a STL model(s) you would like to import during the lab. The STL files can be shared amongst group members when importing multiple models.
- Organisation owners should fork WestonRobot/Limo_ros repository into your groups’ github organisation. Following that, each member of the organisation will fork that repository into your own personal github accounts.
Start of Lab
- We will have a short MCQ quiz on concepts that have been covered in the lecture and those that will be needed during this lab session, concepts covered will be from the readings found below.
Readings
- Limo - Lidar Mapping
- Limo - Lidar Navigation
- TF - tf2 Overview
- ROS Navigation - Setup
- Gazebo - ROS Integration
- ROS Navigation - Map Building
- ROS - Topic Remapping
- ROS - Launch Topic Remapping
Materials
- YDLidar - ROS package Note this package is slightly different fom the package already present in your limo robot, the package present in your limo is currently not available on github
- empty_sit_map.stl
Setup
- Be in your teams of 5
- Tasks & report should be performed by all group members individually unless told otherwise.
Lab Report and Submission
- Throughout this lab, there are tasks that you are supposed to perform and record observations/deductions.
- You can share common experimental data, but not explanations, code or deductions for the lab report.
- Discrepancies between report results and code submissions are liable for loss of marks.
- Each task will be clearly labelled and will need to be included in your lab report, which is in the format “lab4_report_<STUDENT_ID>.doc / pdf”, include your name, student_id at the begining of the report.
- Zip up your lab report and other requirements (if present) and name it “lab4_<STUDENT_ID>.zip” and upload it.
Learning Outcomes
By the end of lab 4, you will have:
- learnt how to create your own gazebo simulation world
- learnt how to integrate your gazebo world into ROS
- learnt how to perform mapping of your simulation world
Lab 4 (4%)
Creating a Gazebo world
Task 1: Importing Models
Gazebo simulation can only use STL, OBJ or Collada (DAE) file formats for imported models. For simplicity, this lab will only require the groups to work with STL files. The STL file found under Materials will serve as the base for your simulation where you will be importing your own models on to.
- Create directory called “meshes” in the limo_gazebo_sim package.
-
Download the empty_sit_map.stl file found under Materials and save it to the /meshes directory.
-
-
To import any model into gazebo, you will need a .world file. For this lab we will be using the empty.world file that can be found in the limo_gazebo_sim package.
-
From the /worlds directory within limo_gazebo_sim package run
gazebo empty.world
-
Under ‘Edit’ select ‘Model Editor’ or press the shortcut keys Ctrl + M.
-
In the model editor, click on ‘Add’ and change the link name to sit_map before importing the empty_sit_map.stl.
-
Do not be alarmed by the size of the imported model. The large size of the model is due to the mismatch in standard units used by Gazebo and CAD software. Go ahead and place the model anywhere in the gazebo world.
-
-
The imported model is also called a link in gazebo. A physical link in the simulation contains inertia, visual and collision properties. To edit the model, right click on the model and select ‘Open Link Inspector’. The pop-up will allow you to change physical properties and geometry related to the link, visual and collision.
- Lets set the pose of the model to the perimeters below so that the limo model can be generated at the global origin without any collision for the second part of the lab.
x = -5.00, y = -2.50, z = 0.00, roll = 1.57, pitch = 0.00, yaw = 0.00
Task 1aWhat does the link of a model define in gazebo? Use relevant sub-properties to explain.
-
The visual perimeters allow users to edit the overall appearance of the model. Properties such as colour, material, texture and size can be changed according to the user’s needs.
- The imported model is scaled up due to Gazebo’s default unit of measurement being metres, while the default unit of measurement for CAD software is millimeters. Hence, we need to scale down the model by 1000. Under the ‘visual’ tab, set the geometry of the model to
x = 0.001, y = 0.001, z = 0.001, roll = 0.00, pitch = 0.00, yaw = 0.00
-
The collision tab defines properties such as friction, bounce and contact perimeters. The yellow frame you see in the gazebo model editor indicates the area of collision when running simulations. Similar to the visual property, the collision area also needs to be scaled down by 1000. Set the geometry of the model to
x = 0.001, y = 0.001, z = 0.001, roll = 0.00, pitch = 0.00, yaw = 0.00
-
Task 1bWhat will happen if the visual property is scaled to 0.0005 instead of 0.001? What impact will the difference in scaling have when simulating the teleoperation of the Limo in the gazebo environment?
-
Task 1cHow are visual and collision related to link?
-
-
Select the ‘Model’ tab and check the ‘static’ box. When a model is set to be static, it becomes immovable. Gazebo’s dynamics engine will not update its position.
-
Under ‘file’ save the model in a folder of your choice and exit the model editor. The final result should be something similar to the image below.
-
You have successfully imported the model into gazebo, save the world in the /worlds directory under limo_gazebo_sim and name it sit.world.
- Now that you are familiar with the whole process, import at least 3 models into the gazebo world you have just created. Within your own groups share the STL models that you and your groupmates have found before coming to the lab.
Task 2: Saving & Launching Worlds
-
For ease of collaboration in the future, it is important to change the absolute path of the models included in your .world file to a relative path, so that others can also use your gazebo environments without editing.
To achieve this, gazebo needs to know where the STL file is saved with respect to the root folder. Gazebo simulation has specific environment variables that can be defined by users to simplify this process. Include the following lines into the package.xml file, within the <package> tag. Edit the package.xml file found within the limo_gazebo_sim package.
<export> <gazebo_ros gazebo_model_path="${prefix}/meshes"/> <gazebo_ros gazebo_media_path="${prefix}/meshes"/> </export>
-
Open the sit.world file and search for <model name=’sit_map’ > tag. Under this tag you will find the <uri> tag that specifies the path of your model. Change that to
<uri>model://sit_map.stl</uri>
Note: There are 2 instances of the path within the file that needs to be changed. Please also be mindful of the indentations.
-
Task 2aWhat is the absolute path of your STL model
-
Task 2bWhy are there 2 instances where the model path is defined?
-
-
To launch the Limo simulation in your new gazebo environment, you will need to specify your world file in the limo_ackerman.launch and limo_four_diff.launch files. In the launch file you will find the line
<arg name="world_name" default="$(find limo_gazebo_sim)/worlds/empty.world"/>
This line sets the world file that will be used when the simulation is launched. Hence we will need to change it to
<arg name="world_name" default="$(find limo_gazebo_sim)/worlds/sit.world"/>
-
Now you are ready to launch the simulation.
roslaunch limo_gazebo_sim limo_ackerman.launch
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Using a Gazebo world
Task 3: Mapping a simulation world
Now that you have a working simulation world, we can now start over first dive into the ROS navigation stack. The ROS navigation stack is a 2D navigation stack, meaning it does its job while only considering a 2d world/map. Essentially, the ROS navigation stack has these parts to allow autonomous navigation…
- Map data of the surrounding environment (not always required)
- Sensor data (typically but not limited to lidar)
- Transforms (or tfs)
- Planners and controllers
Today we will take a look at building a map using the simulation world you have made with the slam_gmapping node within the gmapping package. To build a map, we require environment data from sensors (lidar laserscan in this case)
- Run the simulation world using the launch file you have edited in Task 2.
- Task 3a
- Include a screenshot of the ROS Network in your report.
- What topic name is the lidar laserscan data being published under?
- Now we can run the slam_gmapping node to build the map,
roslaunch limo_bringup limo_gmapping.launch
- Task 3b
- Include a screenshot of the ROS Network in your report.
- What topic name is the slam_gmapping node subscribed to for laserscan data?
- Task 3cFrom task 3a and 3b answers and the rviz window, can you infer what has happened to the map building process and what might be the problem?
- Task 3dFix the problem by modifying the limo gmapping launch file and build a full map of your environment by driving your limo around in the simulation, stopping once in awhile to build a section of the map (the resultant map should be tidy and clean). Describe what you did to fix the problem in your report.
- Task 3e
- We can now save the map by running
rosrun map_server map_saver -f <map_name>
- This should have generated a .pgm and .yaml file representing the map in the directory you have ran the command. Include these 2 files and the modified limo_ros package in your submission.
- We can now save the map by running
EXTRA (Not Graded): Try mapping your classroom using your LIMO, (using limo_start.launch in limo_bringup instead of the simulation launch file).
Submission
Zip up your lab report into a zip file called “lab4_<STUDENT_ID>.zip” and submit by Sunday, 23:59.