Modified 2020-09-11 by Dev Ramesh
Student version (unknown ref duckiesky_high_school_student/sac2-ros-intro)
Hardware - Basestation
Previous Lesson - Sensing
Knowledge -
Definition and purpose of robot middleware
Basic ROS components and vocabulary: topic, message, publisher, subscriber, node, workspace
Skills -
List and echo ROS topics
Create a catkin workspace
Modified 2020-07-21 by Peyton Strong
Modified 2020-07-23 by Dev Ramesh
NGSS: HS - ETS1 - 2: Design a solution to a complex real-world problem by breaking it down into smaller, more manageable problems that can be solved through engineering.
ISTE: 1. d.: Understand the fundamental concepts of technology operations, demonstrate the ability to choose, use and troubleshoot current technologies and are able to transfer their knowledge to explore emerging technologies.
Modified 2020-07-23 by Peyton Strong
Students will be able to undertand what ROS is and make a catkin workspace by the end of the lesson.
Modified 2020-07-23 by Peyton Strong
5 mins: Introducing ROS
45 mins: Reviewing important ROS concepts and commands
10 mins: Making a catkin workspace
Modified 2020-04-16 by Garrett Warren
Modified 2020-08-12 by unknown
Teacher Materials
Basestation, a projector (if needed)
Classroom Set Up
Teachers can write a DO NOW on the board for students to set up their basestations.
Modified 2020-04-16 by Garrett Warren
Modified 2020-08-12 by unknown
5 minutes
Hook
Teachers use this link to:
Give students a sense of the structure of a software diagram.
Illustrate the challenges of software engineering in robotics
Lots of sensors and actuators, and they need to communicate with each other (even in this diagram, not many sensors and actuators but the connections are still fairly complicated)
Processes might live on different computers to spread the computing load
Many software modules need to work together (Need to manage their dependencies)
Modified 2020-08-12 by unknown
45 minutes
Present our solution to the challenges above: ROS (Robot Operating System).
Official Introduction of ROS
“ROS is an open-source, meta-operating system for your robot. It provides the services you would expect from an operating system, including hardware abstraction, low-level device control, implementation of commonly-used functionality, message-passing between processes, and package management. It also provides tools and libraries for obtaining, building, writing, and running code across multiple computers.” (http://wiki.ros.org/ROS/Introduction)
In Short: ROS aims to support code reuse in robotics research and development.
What are the benefits of reusing codes?
- **Wikipedia Verision** "Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality." (https://en.wikipedia.org/wiki/Modular_programming)
- **In Short**: Easy to read, easy to test, easy to reuse, easy to maintain, etc.
To help students understand this, teachers might draw a comparison to reading and writing a book like [this](https://www.durhampriory.ac.uk/colour-your-own-medieval-manuscript-part-5/) versus a book like [this](https://docs.duckietown.org/daffy/downloads/duckiesky_high_school/docs-duckiesky_high_school/branch/daffy-develop/doc-duckiesky_high_school/out/index.html)
ROS master: A node that every other node register in order to communicate with each other. It is created by running roscore command (Detailed: http://wiki.ros.org/Master)
ROS nodes: ROS nodes are programs that communicate with other programs via publishing and/or subscribing to ROS topics. (Detailed: http://wiki.ros.org/Nodes)
Messages: The information that is communicated between nodes. Messages are standardized, which means that certain message types have certain fields. For example, “ROS pose message” has two parameters: position and orientation. They are message types themselves, which contain their own parameters. (http://docs.ros.org/melodic/api/geometry_msgs/html/msg/Pose.html) This makes communication between programs a lot easier (link to the modular programming above). You can even create your own message types!
ROS Topics: Topics are what ROS messages are published and subscribed to. (Detailed: http://wiki.ros.org/Topics)
Publishers: Publishers are used to publish specific message types to specific topics.
Subscribers: Subscribers are used to read the messages being published to a ROS topic.
Print out all of the topics running by entering “rostopic list” into a free window after running ‘screen -c pi.screenrc’ on your drone. Have messages that are being published to a topic printed out by navigating to an empty window in the screen and entering “rostopic echo [topic_name]”. For example, if you wanted to see the data coming from the infrared sensor, you could enter “rostopic echo /pidrone/infrared”
Important ROS Commands:
roslaunch: roslaunch is a tool for easily launching multiple ROS nodes locally and remotely via SSH, as well as setting parameters on the Parameter Server. (Detailed: http://wiki.ros.org/roslaunch)
roscd: roscd allows you to change directories using a package name, stack name, or special location. (Detailed: http://wiki.ros.org/rosbash#roscd)
rostopic: rostopic contains the rostopic command-line tool for displaying debug information about ROS Topics, including publishers, subscribers, publishing rate, and ROS Messages. (Detailed: http://wiki.ros.org/rostopic)
In your future lesson about ROS subscriber, you will create a ROS program to control your LED according to readings in of your sensor. In this case, there will be three nodes: sensor, LED, and controller. The controller node subscribes to the sensor node, receiving its value, determines how the LED should behave, and then publishes its message to the LED node.
Modified 2020-08-12 by unknown
10 minutes
make a catkin workspace following this link.
Useful Resources and References