Skip to main content
ezAce

# 辅导案例-COM2009-3009

May 15, 2020No Comments

University of Sheffield COM2009-3009 Robotics Lab Assignment #1 ‘An Introduction to the Robot Operating System (ROS)’ Lab Instruction Sheet Dr. Tom Howard [email protected] Department of Computer Science March 16, 2020 Contents 1 Overview (please read carefully) 2 1.1 Logistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.1 Simulation and the ROS IDE . . . . . . . . . . . . . . . . . . . . . 3 1.1.2 Working with the Robots . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 The Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.1 Provided Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.2 Hand-In Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.3 Getting Started with the Report Template . . . . . . . . . . . . . 4 2 Working with the TurtleBot3 Waffle 6 2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3 Safe Working . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4 A note about WiFi communications . . . . . . . . . . . . . . . . . . . . . 7 3 Weekly Schedule 8 3.1 Week 1: ROS Concepts 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2 Week 2: Odometry-based Navigation . . . . . . . . . . . . . . . . . . . . . 9 3.3 Week 3: Hands-on with ROS . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.4 Week 4: ROS Concepts 2 – Services . . . . . . . . . . . . . . . . . . . . . . 14 3.5 Weeks 5 & 6: Implementing Subsumption-based Control . . . . . . . . . . 16 3.5.1 Part I: Catching up . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.5.2 Part II: Building an Avoid-Wander Robot using a Subsumption Control Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4 Final Steps 19 A Brooks’ Subsumption Architecture 20 A.1 Level-0: Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 A.2 Level-1: Wander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1 1 Overview (please read carefully) The lab classes for COM2009-3009 take place in Computer Room 3 in the Diamond (DIA-CR3). Session A takes place on Tuesdays from 14:00 to 16:00, and Session B on Wednesdays from 09:00 to 11:00. The aim of the first assignment (running from weeks 1 to 6) is for you to gain practical hands-on experience of ROS (the Robot Operating System), and use this to design, implement and evaluate a robot’s behaviour. You will be working with ROS in both a simulation environment (individually) and on real robots (in groups). The table below provides a broad outline of the lab schedule for the first 6 weeks. Week # Date & Time Details Working Format 1 Tue 11 Feb 2-4pm Wed 12 Feb 9-11am ROS Concepts 1: Simulation Exercises Individual 2 Tue 18 Feb 2-4pm Wed 19 Feb 9-11am Odometry-based Navigation: Simulation Exercises Individual 3 Tue 25 Feb 2-4pm Wed 26 Feb 9-11am Hands-on with ROS: Working with a Robot Group 4 Tue 3 Mar 2-4pm Wed 4 Mar 9-11am ROS Concepts 2 – Services: Simulation Exercises Individual 5 & 6 Tue 10 Mar 2-4pm Wed 11 Mar 9-11am Tue 17 Mar 2-4pm Wed 18 Mar 9-11am Implementing Subsumption- based Control on a Robot Group Table 1: Lab schedule for weeks 1-6 Throughout these lab sessions you will explore a range of tools and libraries that are avail- able within ROS to help Robotics Engineers get up and running with robot applications quickly, and you will learn how to develop your own robot applications using the ROS framework. You will be assessed on a group report that is to be handed-in before 10pm Friday 27th March 2020. See Section 1.2 for further details. 1.1 Logistics You will work in teams of three (assigned randomly, as per University policy), and each team has been allocated a particular robot and laptop. See the list on Blackboard to find your partners and the hardware you will be using. Graduate Teaching Assistants (GTAs) will be in attendance to provide help and ad- vice throughout each laboratory session: Varvara Papazoglou, Ben Hawker, Zeke Hobbs, Blayze Millward, Areeb Sherwani, Will Fraser, Igiri Onaji, Fabio de Mello and Tope Adeosun. Note: The GTAs’ role is to help with your learning and any technical issues you may be facing, NOT to debug your programs. 2 1.1.1 Simulation and the ROS IDE As discussed above, you will learn about a lot of the core ROS concepts in simulation, and for this you will work individually on the workstations in DIA-CR3 using a cloud-based integrated development environment (IDE) called ROS Development Studio (ROSDS): https://www.theconstructsim.com/rds-ros-development-studio/. Follow the link and click on the ‘Getting Started’ button to sign up for a free account1. As shown in Table 1, you will be working in ROSDS for the first two weeks, and will then return to this again later in the semester. Note: You will sit with your groups for every lab session, even when working individually on ROSDS. We encourage you to work together as a team and help each other throughout all the laboratory sessions. 1.1.2 Working with the Robots Your first chance to work with robots will occur in week 3, where you will work in groups with a customised version of the TurtleBot3 Waffle2. Robots and laptops will be made available in the computer room before the start of the session. Laptops and robots have already been paired and are therefore not interchange- able: Laptops are numbered 1-40 (indicated with a sticker on the underside), and have been paired with a particular TurtleBot3 whose id is printed on a name sticker on the top and is of the form “dia-waffleX”, where X is a number 1-50. Please refer to the list on Blackboard to find out which robot and laptop you will be working with. GTAs will be on hand to distribute the hardware to you from special cabinets. Designate one person in your group to collect your robot and another to collect your laptop. You will also need to collect a charger for the laptop, and it is recommended that you work with the laptop plugged in and charging whenever possible throughout the lab sessions. Please work with your groups around the workstations that have been designated to you (even though you may not necessarily need to use the workstations for the session). Note: Please ensure that you carefully read the guidelines provided in the ‘Working with the TurtleBot3 Waffle’ section of this Lab instruction sheet before handling and working with your TurtleBot3. The robots are delicate and it is important that you work with them appropriately to ensure that no damage occurs to the robot or any of its instrumen- tation. At the end of each lab session turn off your robot, shutdown your laptop and return them both – along with the laptop charger – to the correct cabinet that it originally came from. GTAs will be on hand by the cabinets to take them from you. Note: You must not take a robot out of DIA-CR3 under any circumstances! 1.2 The Assignment Lab Assignment 1 is worth 25% of the overall mark for COM2009-3009. Each group must work together to complete an answer sheet using these instructions as a guide. There are a number of questions for you to answer based on the work you have done in each week’s lab session. Different questions carry different marks, where the maximum marks 1You can ‘Sign up with Google’ using your sheffield.ac.uk email address and account credentials. 2http://emanual.robotis.com/docs/en/platform/turtlebot3/overview/ 3 available for each question is indicated along side it. You only need to submit one report per group. 1.2.1 Provided Materials In addition to these instructions, you have been provided with a .zip file containing a number of items that you will need for this assignment (available on Blackboard). In particular, you have been supplied with a LATEX template – Lab1-Group0z.tex – which you will use to compile your responses. LATEX is a free document preparation system for high-quality typesetting 3, and having a working knowledge of LATEX is a key skill for any computer scientist 4. LATEX is very easy t
o learn, and there are many resources available on the web, e.g. https://www. sharelatex.com/learn/Learn_LaTeX_in_30_minutes. LATEX distributions are available for Linux, Mac OSX and Windows (see: https://www. latex-project.org/get/). However, for this assignment, you might like to use an on- line development environment such as Overleaf (https://www.overleaf.com). F Step 0: Before you start working with LATEX, edit the filename of the provided Group0z.tex file by replacing 0 with your group number and z with your session id (‘a’ if you are attending Session A on Tuesday afternoons, or ‘b’ if you are attending Session B on Wednesday mornings). More details are provided in Section 1.2.3. Your edited .tex file should compile to produce a .pdf document with your names on the front cover, followed by your responses to a number of questions. You will be submitting the .pdf file when you have completed the assignment, not the .tex file. 1.2.2 Hand-In Procedure Your group report should be submitted as a single .pdf file to Blackboard. You do not need to submit a paper copy. Please make sure that your names, group number and session id are shown correctly on the front page of your report. The next section explains how to do this. The deadline is 10pm Friday 27th March 2020. Note: Each group should submit one report, so you’ll need to select one member of your group to submit it to Blackboard. 1.2.3 Getting Started with the Report Template There are a number of options available for working with and creating LATEX documents however we recommend that you use Overleaf (https://www.overleaf.com) for this 3LATEX includes features designed for the production of technical and scientific documentation, so it is the de-facto standard for the publication of scientific/technical papers and reports. Unlike WYSIWYG (“What You See Is What You Get”) word processors (such as Microsoft Word or OpenOffice), LATEX is based on plain-text source files (containing html-style markup) which are compiled into a typeset document. This separation of ‘content’ from ‘style’ facilitates the production of very professional scientific documents in terms of their consistency, readability and design. You can find out more about LATEX here: https://www.latex-project.org. 4The Department strongly recommends that you consider using LATEX for your Dissertation, and Prof. Moore has provided a template here: http://staffwww.dcs.shef.ac.uk/people/R.K.Moore/campus_ only/USFD_Academic-_Report_LaTeX-Template.zip. 4 assignment. You will need to consider how you will share the working document with your group members so that you can all access and contribute. One option would be to use a shared Overleaf account, or alternatively, you could consider using Google Drive, or GitHub, to share your working document amongst your group members. F Step 1: Download the report template .zip file from Blackboard. F Step 2: Upload this to Overleaf (or any other LATEX IDE of your choosing). F Step 3: Change the name of the Lab1-Group0z.tex file to indicate your specific group id. Replace the 0 with your group number, and replace the z with your session id (‘a’ if you are attending Session A on Tuesday afternoons, or ‘b’ if you are attending Session B on Wednesday mornings). e.g. If your group number is 5, and your group has been allocated to Session B (on Wednesday mornings), then the name of your .tex file should be Lab1-Group5b.tex. F Step 4: Open the .tex file to start editing. F Step 5: Under the % EDIT YOUR NAMES section near the beginning of the template, replace the [Your Name 1], [Your Name 2] and [Your Name 3] fields (including the square brackets) with the name of your individual group members. F Step 6: Duplicate the section indicated by the % DUPLICATE THIS SECTION FOR EACH QUESTION as appropriate, so that you have a dedicated “answer section” for each assign- ment question. Copy the questions from this instruction sheet across to your report template and fill in your answers where indicated in the report template. F Step 7: Once complete, create a .pdf of your report and submit this on Blackboard (a link for this will go live later in the semester). 5 2 Working with the TurtleBot3 Waffle 2.1 Overview The robots that you will be working with throughout this semester are a customised version of the standard TurtleBot3 WafflePi model as detailed on the Robotis Website5. The robot is shown in Figure 1 below. Figure 1: The TurtleBot3 Waffle Robots that you will be working with The robot is comprised of the following core hardware elements:  Independent left and right wheel motors (DYNAMIXEL XM430’s) to drive the robot in a differential drive configuration  An OpenCR Micro-Controller Board to power and control the wheel motors, dis- tribute power to other hardware elements, and provide an interface for additional sensors  An UP Squared (or UP 2) Single-Board Computer (SBC) with an Intel Processor and 32GB on-board eMMC storage. This acts as the “brain” of the robot In addition to this, the robot is equipped with the following sensors:  A Light Detection and Ranging (or LiDAR) sensor, which spins continuously when the robot is in operation. This uses light in the form of laser pulses to allow the robot to measure the distance to surrounding objects, and provides the robot with a 360◦ view of its environment.  An Intel RealSense D435 Camera with left and right imaging sensors, allowing depth sensing as well as standard image capture  A 9-Axis Inertial Measurement Unit (or IMU ) on-board the OpenCR Micro Con- troller board, which uses an accelerometer, gyroscope and magnetometer to measure the robot’s specific force, acceleration, and orientation. This sensor is fundamental to the ROS Navigation System. 5http://emanual.robotis.com/docs/en/platform/turtlebot3/overview/#overview 6  Independent encoders within each of the DYNAMIXEL wheel motors, to provide indication of left and right wheel speed and rotation count 2.2 Handling These robots have lots of exposed sensors and electronics and so you must take great care when handling them to avoid the robots becoming damaged in any way. When handling the robot, always hold it by either the black waffle layers, or the vertical support pillars. Note: Do not pick the robot up or carry it by the camera or LiDAR sensor – these are delicate sensors which can be easily damaged. A lot of the electronics are housed on the middle waffle layer. Try not to touch any of the circuit boards, and take care not to pull on any of the cabling or try to remove or rehouse any of the connections. If you have any concerns with any of the electronics or cabling, if something has come loose, or your robot is not working then ask a GTA to have a look at this for you. The robots will be supplied to you by the GTAs with a battery already installed and ready to go. Do not try to disconnect or remove the battery yourselves. The robot will beep when the battery is low, and if this happens ask a GTA to provide you with a replacement. 2.3 Safe Working You will each need to review a risk assessment before you work with the robots in Computer Room 3 for the first time. This will be provided to you via Blackboard before the start of the week 3 lab session, and you will need to answer a short questionnaire on Blackboard before you can get started with the lab work. See Section 3.3 for further details. Note: There is a dedicated ‘Robot Arena’ in the middle of Computer Room 3 for using the robots. Please do not step inside the robot arena yourselves to avoid any damage to any robots that are running. If you need to get access to your robot – or to place it within the centre of the arena – please ask a demonstrator to do this for you. 2.4 A note about WiFi communications Your robot and laptop will communicate with one another over the DIA-LAB WiFi network (you will need to consider the drawbacks of network-based vs. local control and how to manage this, as it will likely impact you during these sessions!) The credentials for DIA-LAB have already been set on the laptop and robot, and both devices should therefore connect to this strai
ght away. Note though, that when the laptop is connected to the DIA-LAB network it will not be able to connect to the internet. You will need to connect the laptop to eduroam if, at any point during this session, you need to access any external resources. The WiFi access credentials for eduroam should also have already been set, but speak to a GTA if you are having any difficulties. 7 3 Weekly Schedule 3.1 Week 1: ROS Concepts 1 Note: You can view the Jupyter notebook from this weeks session on GitHub here: https://github.com/tom-howard/COM2009_WK01/blob/master/wk01_ROS_Concepts_1. ipynb This week you will be working in the ROSDS simulation environment, and you must work through the exercises independently using the DIA-CR3 workstations. As dis- cussed in Section 1.1.1 however, you will be sitting next to your other group members and we encourage you to support one another and discuss your progress throughout the session. F Step 1: Click on the following link to access the lab content for this week: http: //www.rosject.io/l/fdf0a53/. This link will take you to ROS Development Studio (ROSDS), which you can access from any web browser (although chrome and firefox are recommended). F Step 2: Create a free ROSDS account if you haven’t already done so (see Section 1.1.1) or log in and a ROSject called ‘TUoS COM2009-3009 Robotics Labs Week 1 2019-20’ containing all the material for this week’s lab session will be downloaded to your dashboard area. Click the “Open” button to get started. F Step 3: The first thing you should see when you launch the Week 1 ROSject is a Jupyter Notebook containing all the instructions for this week’s session. Complete all the exercises as described in the Jupyter Notebook. F Step 4: Once complete, follow the instructions (as also provided in the Jupyter Note- book) to save and download a copy of your work. F Step 5: Before you leave get together in your groups and review the assignment questions below. Make sure, as a group, that you can answer the questions appropriately and make a start on your group report using the report template on Blackboard, and the guidelines provided in Section 1.2.3. F Step 6: Copy across the questions below into your group report, and make a start on answering them. It is up to you as a group whether you complete this now, or work on it together outside of this lab session, but you should agree this with your group members before you leave and make a plan amongst yourselves. QUESTION 1 (worth up to 6 marks) What are the advantages of using a launch file in ROS? What ROS command should be used to load a launch file, and what is the syntax for using this in a Linux terminal? QUESTION 2 (worth up to 5 marks) What is the difference between a package and a node, and what are the three things that must exist in order for a package to be valid in ROS? Week 1 Complete. 8 3.2 Week 2: Odometry-based Navigation Note: You can view the Jupyter notebook from this weeks session on GitHub here: https://github.com/tom-howard/COM2009_WK02/blob/master/wk02_Odometry_Based_ Navigation.ipynb This week you will be working in the ROSDS simulation environment again, and will be building upon the essential ROS skills that you learnt about during last week’s session. As before, you must work through the exercises individually using the DIA-CR3 work- stations. Again, you will be sat with your other group members, so talk to one another and support each other throughout the session. F Step 1: Click on the following link to access the lab content for Week 2: http: //www.rosject.io/l/fb5d2f4/. F Step 2: Sign in to ROSDS using the account credentials that you set up previ- ously. F Step 3: The ‘TUoS COM2009-3009 Robotics Labs Week 2 2019-20’ ROSject will be downloaded to your dashboard area. Click the “Open” button to get started. F Step 4: Complete the exercises in the Jupyter Notebook for this week’s session. You don’t necessarily need to complete the final exercise if you run out of time during the lab session but bear in mind that you will need to have a working solution to this as a group in order to start working with the robots next week. F Step 5: Discuss as a group how you are progressing with the final exercise and work together on this if you need to. Remember that you can access ROSDS on any computer (all you need is a web browser), so you could always arrange to work together outside of the lab session if you need to. You don’t all need to have a working solution individually. F Step 6: Once complete, follow the instructions in the Jupyter Notebook to save and download a copy of your work. F Step 7: Before you leave get together in your groups and review the assignment questions below. Copy across the questions into your group report and make sure, as a group, that you can answer them appropriately. It is up to you as a group whether you complete the answers now, or work on them together outside the lab session, but you should agree this with your group members before you leave and make a plan amongst yourselves. QUESTION 3 (worth up to 4 marks) What topic do we need to publish messages to to make the TurtleBot3 Robot move? What type of message does this topic use, and what format does the message take? QUESTION 4 (worth up to 4 marks) Using the rostopic echo command, we obtain the following data from the /odom topic to inform us of our robot’s current odometry: pose: pose: position: x: 0.649356 y: -0.374484 9 z: 0.0 orientation: x: 0.0 y: 0.0 z: -0.469191 w: 0.883097 How far has the robot moved from its origin in the X-Y plane? (Explain briefly how you arrived at this answer) QUESTION 5 (worth up to 3 marks) What tool can we use to help us build our own packages in ROS, and where do we need to locate custom packages within the Linux filesystem of our robot or remote machine? Week 2 Complete. 10 3.3 Week 3: Hands-on with ROS Note: You can view the Jupyter notebook from this weeks session on GitHub here: https://github.com/tom-howard/COM2009_WK03/blob/master/wk03_Hands_on_with_ a_real_robot.ipynb This week you will work in your groups with a real TurtleBot3 Waffle, and will explore some of the built-in capabilities of ROS. Before you get started, make sure that you re-read Section 2 of this document to remind yourselves how to handle and work with the robot appropriately. Note: There is a compulsory pre-lab risk assessment quiz that you must each complete on Blackboard before you start this weeks lab, to make sure that you are aware of the health and safety practices that you must follow when working during these laboratory sessions. Every member of your group must have complete the pre-lab quiz before your group will be allowed to collect a robot. F Step 1: Log into Blackboard individually on the CR-3 workstations and follow the link to the pre-lab health and safety risk assessment and quiz. Once all your group mem- bers have completed this, get the attention of a GTA who will check your scores. You should now perform the following steps as a group: F Step 2: Locate the Lab1 student-robot-allocations.pdf in the Lab Assignment #1 folder on Blackboard to view the most up-to-date robot allocation list and find out which robot and laptop your group will be working with. Head across to the laptop and robot cabinets with this information and a GTA will provide you with the correct hardware. Then return to your group by your allocated workstations. F Step 3: Turn on the laptop and log in using the “robot” user account and the password that will be provided to you separately. F Step 4: Make sure the laptop is connected to the eduroam WiFi network. Note: Whilst working on these laptops you may at some point see a message asking if you would like to install software updates (as below) or update the operating system to the latest version. Please do not perform any sort of updates on this laptop, and just dismiss any messages, such as this, which may appear. F Step 5: Open a terminal window using the CTRL+ALT+T keyboard shortcut (or oth- 11 erwise), and enter the following commands (excluding the $symbol) in the order shown below (note that in order to paste commands into the l inux terminal you will need to use the CTRL+SHIFT+V keyboard shortcut): 1.$ mkdir -p ~/com2009/labs && cd ~/com2009/labs 2. $git clone https://github.com/tom-howard/COM2009_WK03.git Note: If you get the message: “fatal: destination path ‘COM2009 WK03’ already exists and is not an empty directory”, just carry on but skip step 4. 3.$ cd COM2009_WK03/ 4. $chmod +x past_weeks.sh && ./past_weeks.sh 5.$ conda activate && jupyter notebook F Step 6: A web browser will open showing a jupyter dashboard and a file tree. Click on the wk03 Hands on with a real robot.ipynb file in the root of the file tree to launch the Jupyter Notebook for this week’s lab session. F Step 7: Complete all the exercises as a group, or at least make sure that you can do enough to answer the assignment questions below. F Step 8: When you have completed the lab session, make sure that you refer to the “Next Steps” section at the very bottom of the notebook to guide you through the process of shutting down your robot correctly. Make sure that you take a copy of any code and/or data away with you. F Step 9: Before you leave get together in your groups and review the assignment questions below. Copy across the questions into your group report and make sure, as a group, that you can answer them appropriately. It is up to you as a group whether you complete the answers now, or work on them together outside the lab session. Make a plan amongst yourselves. QUESTION 6 (worth up to 5 marks) Provide two images in your report showing: 1. The map that your robot generated in Exercise 4 2. A photograph of the actual arena that your robot was operating in Compare the two images. How well did your robot map it’s environment, were there any areas where the mapping process did not perform well, and why might this be the case? If you didn’t manage to complete this on the robot, and you have been struggling with the simulation too, then please answer question 6A instead: QUESTION 6A (worth up to 5 marks) Which SLAM method did we use in Exercise 4, name two tuning parameters that are available for this, and explain what each of these do. QUESTION 7 (worth up to 6 marks) What information does the SLAM algorithm need to build a map? Where on the Turtle- Bot3 Robot does this information come from, and which ROS topics could we listen to to obtain this information? QUESTION 8(worth up to 6 marks) Discuss your implementation of the move square.py node and comment on how well it worked. Explain why Odometry-Based Navigation can lead to error. 12 If you didn’t manage to complete this on the robot, and you have been struggling with the simulation too, then please answer question 8A instead: QUESTION 8A (worth up to 6 marks) This week you were provided with a move square template.py file to assist you with developing your move square node. Explain what the callback function is doing here, and explain how you might have accessed and used the data from this in the main loop() to achieve the desired outcome. Week 3 Complete. 13 3.4 Week 4: ROS Concepts 2 – Services Note: You can view the Jupyter notebook from this weeks session on GitHub here: https://github.com/tom-howard/COM2009_WK04/blob/master/wk04_ROS_Services.ipynb This week you will be returning to ROSDS and working in simulation again to learn about another method of communication in ROS using Services. As with weeks 1 and 2, you must work through the exercises individually whilst sitting with your other group members around the workstations allocated to your group. Again, talk to one another and support each other throughout the session. F Step 1: Click on the following link to access this week’s lab ROSject: http://www.rosject.io/l/10ecd4ab/. F Step 2: Sign in to ROSDS using the account credentials that you set up previ- ously. F Step 3: The ‘TUoS COM2009-3009 Robotics Labs Week 4 2019-20’ ROSject will be downloaded to your dashboard area. Click the “Open” button to get started. Note: A direct link to a ROSject (such as the one in Step 1 above) should only ever be used once. Following the link will generate a ‘fork’ of the ROSject in your own dashboard area within ROSDS, which you can launch, work on and edit as you please. If you click the link multiple times, this will create multiple instances (‘forks’) of the original ROSject within your dashboard area! Once you have created your own fork, you should just use the main ROSDS URL6 to return to the IDE whenever you need to. F Step 4: Complete the exercises in the Jupyter Notebook for this week’s session and, when complete, follow the instructions to save and download a copy of your work. F Step 5: Before you leave get together in your groups and review the assignment questions below, copy them across into your group report and make a plan about how, and when, you will complete these as a group. QUESTION 9 (worth up to 4 marks) How do ROS Services differ from the standard topic-based messaging (publisher / sub- scriber) approach that you have learnt about in previous weeks? Provide examples of two robot applications where it might be useful to use ROS Services. QUESTION 10 (worth up to 8 marks) Which ROS command would you use to obtain information about a service that is cur- rently active on a ROS robot? Name three important pieces of information that this command would provide us with, and explain the meaning of each of these. QUESTION 11 (worth up to 7 marks) Which ROS command would you use to obtain information about a particular service message? Explain the format of a service message (there are 4 key points here). If you were building a service client, which part of the message would you be most interested in? QUESTION 12 (worth up to 8 marks) What does the data from the LiDAR sensor tell us about our robot? Which ROS topic is this data published to, and what is the message type? Why might this information be more valuable than odometry data when developing robot navigation algorithms? 6https://www.theconstructsim.com/rds-ros-development-studio/ 14 Week 4 Complete. 15 3.5 Weeks 5 & 6: Implementing Subsumption-based Control 3.5.1 Part I: Catching up Firstly, if you didn’t manage to get enough done during the week 3 session to allow you to answer the assignment questions in Section 3.3, then you can spend some time doing this if you want to. Bear in mind though, that you should now try to prioritise your time on the tasks within Section 3.5.2, so don’t spend too long with your robot trying to catch up on Week 3. A Note on Week 3, Exercises 4 & 6 You may not have been able to complete the SLAM and Navigation exercises during the week 3 lab session as a result of (for example) the robot arena being too crowded, or your group struggling with WiFi connection issues. If this was the case, then you could always complete these exercises in simulation instead. Question 6 in Section 3.3 requires you to provide a map obtained using the mapsaver node, having generated this with your robot within the robot arena using SLAM. It is perfectly acceptable for you to obtain this by running SLAM in simulation instead, if you need to. Bear in mind though that, for the assignment question, you will need to also provide a picture of the environment that you mapped, which in this case would need to be a screenshot of the gazebo window with your robot in it’s environment. Also note that when performing this in simulation, you might find that the mapping process performs a lot better than if you were to have done this in the robot arena in CR3! You could always talk to some of your colleagues in other groups who did manage to complete this during the week 3 session, to find out how well their mapping process worked. Use this as the basis for your answer to the final part of Question 6: “…were there any areas where the mapping process did not perform well, and why might this be the case?” A ROSject has been created as a test area for the Week 5 & 6 exercises (as described in the following section), and you can also use this to complete both the SLAM and Navigation exercises from Week 3, in simulation, if you need to. See Section 3.5.2 for the link to the ROS
ject. Remember: You could always do this in your own time so as to make the most of your time with the robots working on the tasks in Section 3.5.2 over the next two weeks. A Note on Week 3, Exercise 5 Exercise 5 requires you to implement the move square.py node on your robot. If you still haven’t managed to do this and the reason for this is that you are still working on the code, then return to your Week 2 ROSject in ROSDS7 and get it working in simulation first, as this will be far quicker and easier than trying to develop and debug the code on your robot. The power of simulation is one of the great advantages that robotics developers have when developing robot applications in ROS, so make the most of it! Again, remember: You could always do this development work in your own time too. Try not to spend too long on this over the next two weeks, and focus your attention on the subsumption tasks described in Section 3.5.2 below. 7https://www.theconstructsim.com/rds-ros-development-studio/ 16 3.5.2 Part II: Building an Avoid-Wander Robot using a Subsumption Con- trol Architecture In Lecture 48 you were taught about a layered ‘subsumption’ architecture as the basis for implementing robust control of a mobile robot. The paper by Brooks that was referenced in the lecture, and within which this control method was originally defined, summarised the approach as follows: “Layers of control system are built to let the robot operate at increasing levels of competence. Layers are made up of asynchronous modules that com- municate over low-bandwidth channels. Each module is an instance of a fairly simple computational machine.”9 In fact, ROS operates on exactly the same principle, where an entire robot application is made up of individual Nodes (or modules in Brooks’ terminology), which are essentially standalone executable scripts that perform certain tasks (i.e. simple computational ma- chines). As you should now know, ROS Nodes run and communicate asynchronously by publishing and subscribing to ROS Topics using standardised messaging formats. In the lecture, you were taught how this method had been used, by Brooks, to implement 3 levels of robot behaviour:  Level-0: Avoid  Level-1: Wander  Level-2: Explore and Prof. Moore demonstrated the implementation of some of these layers on a Lego EV3 robot. Your tasks for Weeks 5 & 6: For the next two weeks you should attempt to implement the first 2 subsumption layers defined above: ‘Avoid’ (Level-0) and ‘Wander’ (Level-1) on your own TurtleBot3 robot. Use the ROS concepts that you have learnt about over the first 4 weeks of this course to develop a modular control architecture, starting by developing the Level-0 functionality and then building upon this to introduce the Layer-1 functionality on top, which subsumes certain Level-0 modules. Further details on the modules that comprise each of the layers, and how they are structured, are provided in Appendix A. Some particular ROS concepts that you have learnt about so far, and which you may find useful are as follows:  Building publisher and subscriber nodes to communicate with one another on topics  Organising your work into packages and developing standalone nodes to replicate the functionality of the modules within each subsumption layer. See Appendix A for more details on the layer structure.  Using the /cmd vel and /odom topics to control and monitor your robot’s position  Using the /scan topic to detect the environment and obstacles (both stationary and moving) and using this information to make your robot act accordingly 8https://staffwww.dcs.shef.ac.uk/people/R.K.Moore/campus_only/COM2009-3009/Lecture% 20Notes/COM2009-3009_L4_Autonomous-Systems.pdf 9Brooks, R. (1986). A robust layered control system for a mobile robot. IEEE Journal of Robotics and Automation, 2(1), 14-23. 17 You will have access to your robots for the lab sessions over the next two weeks, but you might in some cases find it easier and quicker to develop some of your code in simulation, before testing it out on the actual robot. A simulation area has been set up within ROSDS for you to do this, and you can access this and add it to your own personal ROSDS dashboard by following the link below: http://www.rosject.io/l/10fd643b/ Note: You are not expected to have implemented all the functionality of both subsumption layers within the two weeks that you have for this, but try your best to get as far as you can as you will be able to claim a few more marks in Question 3.5.2 based on the amount of functionality you are able to implement. The first two subsumption layers, and the individual modules (or nodes) that were defined by Brooks to achieve them, are discussed in a bit more detail in Appendix A. This question removed: QUESTION 13(worth up to 7 marks) How much of the Avoid-Wander functionality did your group manage to implement on your robot? Note: The GTAs will have been keeping track of your progress throughout the sessions to verify what you report here! Questions 14 and 15 updated: QUESTION 14(worth up to 18 marks) Explain what you would have done to fully implement the Avoid subsumption layer (Layer-0) in terms of the development of your individual ROS nodes and the interconnec- tions between them. QUESTION 15(worth up to 10 marks) Explain what you would have done to implement the Wander subsumption layer (Layer- 1) in terms of the development of ROS nodes, the interconnections between them and the interactions with Layer-0. End of Assignment #1 tasks. See Section 4 ‘Final Steps.’ 18 4 Final Steps Congratulations, you have almost completed this assignment. All that is left now is to answer Question 16, ensure that you have answered all the other questions within this document, finalise your report and submit it as a pdf to Blackboard for marking (a link will go live during Week 6). QUESTION 16 Please provide a table within your report like the one below, to indicate each group member’s contribution to this assignment as a % (adding up to 100%). Include as many rows as appropriate for the size of your group. Group Member % ? ? ? ? ? ? You can use the following code to replicate this table in your own report: \begin{center} \begin{tabular}{ | p{6cm} | p{1cm} | } \hline \bf{Group Member} & \bf{\%} \\ \hline ? & ? \\ \hline ? & ? \\ \hline ? & ? \\ \hline \end{tabular} \end{center} Lab Assignment #1 Complete. 19 A Brooks’ Subsumption Architecture As defined in Brooks, R. (1986). A robust layered control system for a mobile robot. IEEE Journal of Robotics and Automation, 2(1), 14-23. A.1 Level-0: Avoid Overall, the Avoid layer should make sure that the robot does not come into contact with other objects. If it detects something approaching it, it should search for a new open space and move towards it to maintain its distance from other objects. If nothing comes near the robot, then it shouldn’t move. Figure 2: Module structure for control Level-0 Module Function sonar Produces a map of all obstacles surrounding the robot (i.e. could be obtained from a 360◦ LaserScan published to the /scan topic). collide Monitors the sonar map and sends a halt signal to stop the robot if an object is detected dead ahead. feelforce Considers each detected obstacle as a repulsive force and generates a sin- gle resultant force which would indicate the direction where the motion path is least restricted by obstacles (i.e. a ‘path of least resistance’). runaway Monitors the feelforce force and sends a heading to the turn module to direct the robot away from obstacles (if force is significant enough) turn Communicates with the actual robot (i.e. via /cmd vel) and turns the robot on the spot based on a heading signal so as to point towards the ‘path of least resistance’. forward Once the turn module has acted, the forward module drives the robot forwards in the heading direction (again using /cmd vel). Table 2: The functions of each of the Level-0 modules 20 A.2 Level-1: Wander With the addition of the Wander layer, the robot should no longer just sit in an open space until an object approaches it. After some time it should start to move again, whils
t ensuring it still maintains a position in free-space. Figure 3: Module structure for control Level-1 Module Function wander Generates a new heading for the robot after a certain period of inactivity avoid Takes the force from Level-0 as an input and combines this with the head- ing from the wander module to produce a new heading which should also avoid any nearby obstacles. This heading signal would then sub- sume the one from the Level-0 runaway module. Table 3: The functions of each of the Level-1 modules 21