up:: RDL MOC
tags:: RDL

lecture02-battery-handling-0.pdf
https://opencast03.zmml.uni-bremen.de/paella/ui/watch.html?cid=e116654a536b7a136e8c82eb6068ce9c&id=14c48410-716b-4304-9c45-f570bc5fb726

Overview

Ubuntu and ROS 2 running on both machnies.
teleoperation programm based on ROS 2 sends out veloctity comman

What Do We Need

  • Operating System
  • Robot Operating System (ROS)
  • Programs based on ROS

Operating System

Lecture-02-Part-01-Intro-to-OS-0.pdf

Software Strcuture

  1. Hardware Robots Hardware
  2. Operating System Ubuntu
  3. Libaries and Utilities ROS, Python / C++ libaries & tools
  4. Application Software Robot Application Software (Python /C++)

What is an Operating System?

“Operating Systems are those programs that interface the machine with the application programs. The main function of these systems is to dynamically allocate the shared system resources to the executing programs. As such, research in this area is clearly concerned with the management and scheduling of memory, processes, and other devices.”

  • slightly adapted from What can be automated?: The Computer Science and Engineering Research Study, MIT Press, 1980.

Functions of an Operating System

  • Development of programs
    • Tools such as editors, compilers, interpreters, debuggers to help users to develop new programs.
  • Execution of programs
    • Load the program into memory and run it on the CPU/GPU.
  • Access to Input and Output (I/O) devices
  • Access to stored files
    • Enable storage and retrieval of files on different storage media
  • Detect and respond to hardware and software errors.
  • Resource management
    • Decide which executing program gets access to CPU or RAM when and for how long.

    • Decide if and when a program can be given access to I/O devices during execution.

    • Control which program gets access to which files.

CLI Commands

linux_cheatsheet-0.pdf

  • mkdir : To create a new directory (folder) inside the current directory
  • ls: To list the contents of the current directory
  • cd: To change the current directory to another directory
  • pwd: To know the current working directory

For more details, check out:
https://assets.ubuntu.com/v1/f401c3f4-Ubuntu_Server_CLI_pro_tips_2020-04.pdf
https://ubuntu.com/tutorials/command-line-for-beginners#1-overview

Shell Script

file with .sh
Shell scripts start with the line #!/bin/sh

bash.rc is allways run at Terminal startup.

Futher information under: https://www.shellscript.sh/

Process

Simply put, a process is a program in execution.
List Process with: ps

Killing Process

Kill current Process with Ctrl+C or Exit
Kill other Process with “kill –9 {process-id}“

Inter-Process Communication

  • In Ubuntu, the piping operator (|) helps to redirect the output of one command to the input of the other
    cat song.txt | grep “robot”

Remote Access

  1. Connect an extract monitor and keyboard to the robot
  2. Or, login to the robot from another PC wich already has I/O devices
    • This can be done using the command “ssh”.

    • From the CLI of your PC, type: ssh username@robot-ip-address

    • Whatever commands you execute from this CLI window will be executed on the robot.

ROS

lecture02-robot-operating-system-0.pdf

ROS Introduction

  • New fancy Paper is written
  • Professor asks Student to implement Paper
  • Paper is badly written
  • Code base of Paper is badly written
  • Students wants to reimplemt the Paper
  • Student codes for hours.
  • Student runs out of time.
  • Students graduates
  • Cicle starts all over again

Solution

  • Standardize components (that can be documented),

  • build generic tools,

  • split the work to multiple people by building a community and

  • make the industry part of this community

ROS comes with

  • Plumbing
  • Tools
  • Capabilities
  • Ecosystem

ROS distributions

ROS Nodes

  • Single Purpose
  • A small Python or C++ Programm

Example:

  • Motor node
  • teleoperation node
  • laser scanner node
  • mapping node

ROS Node Communication


With Topic
Publisher / Subscriber System

Publisher pushes data to topic
Subscriber listens to topic
No Feedback

Topic-Problem: You don’t know if your message got received

  • ROS Services
  • Request and Response
  • Multiple can call services but only one service

ROS Start-Up

  • launch files are used
  • can call launch nodes or other launch files

ROS CLI

  • colcon build: Build all packages in the workspace.
  • ros2 node list: Outputs a list of available nodes.
  • ros2 topic list: Outputs a list of active topics.
  • ros2 interface show : Outputs the interface definition.
  • ros2 run : Runs an executable (node). I ros2 launch : Runs a launch file.

ROS1 vs ROS2

ROS1 Server Client System
ROS2 Data Distribution Service

Build:

  • ROS 1 uses catkin_make or catkin build
  • ROS 2 uses colcon

ROS 1 has separated commands like roslaunch, rostopic, …
ROS 2 commands are run with ros2 followed by a space, like ros2 launch or ros2 topic.

Starting Nodes

ROS 1 launch files are written in XML.
ROS 2 launch files are written in Python. (you can still force XML)

Developing Nodes

The Python 2 API for ROS 1 is rospy.
The Python 3 API for ROS 2 is rclpy

ROS Wiki

ROS 1 Wiki: https://wiki.ros.org/
ROS 2 Documentation: https://docs.ros.org/en/humble/

References

ROS 2 docs: https://docs.ros.org/en/humble/
Books about ROS at https://wiki.ros.org/Books
ROS forum: https://answers.ros.org/

Programming in Python

Lecture-02-Part-03-Programming-in-Python-0.pdf

==Only noting what i don’t know

Inheritance with:

class Humanoid(Robot):  

next: RDL VL 03 Sensors