Skip to content

A Bash Script framework for Docker providing basic conventions and helper scripts in the context of Robotics classes

Notifications You must be signed in to change notification settings

vrepetskyi/put-ai-rob-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PUT / AI Robotics 1 laboratories

Motivation

The purpose of this framework is to optimize the work done around Docker in the context of Robotics classes:

  • reduce redundancy both in routine tasks and storage, network usage
  • introduce conventions via sources, materials, and solutions directories
  • preserve observability of sources and materials

Moreover, this framework will gently familiarize you with Docker
You're highly encouraged to explore all the scripts in it as they are annotated
This will allow you to add Docker to your toolset

The suggested workflow is presented next 👇

A comprehensive example

Assume you run all the terminals during a single session

Terminal 1:

# Set up and connect to a container for laboratory number 7
# Because of the --rm option the container will
# be removed after you exit from the shell
./robgo.sh 7 --rm

# Make the ROS running
roscore

Terminal 2:

# Connect to the same previously run container
./robgo.sh 7

# Pick and download a supplementary BAG file
robget pick

# Prepare the downloaded file for playing
rosbag play /materials/7/walking_robot.bag --clock --pause

Terminal 3:

# Again, connect to the same container
./robgo.sh 7

# Go to the source directory of Catkin packages
cd /catkin_ws/src

# Create a new package called center-of-shanks
catkin_create_pkg center-of-shanks std_msgs rospy

# Both /materials/ and /solutions/ directories
# are stored outside of the container

# Move the newly created package there so it
# is not lost when the container is removed
robshare center-of-shanks

# Check whether the package has been moved
# You will see that now it is a symlink
# to /solutions/7/center-of-shanks
ls -l

# Later when you want to restore the package
# run the same command and the center-of-shanks
# symlink will appear in your current directory

# The robshare script supports complex
# absolute and relative paths as well

# Finally, you will want to exit the container
exit

Rare cases

# Run one more independent container for the same laboratory

# The next time robgo will send you to the new container

# Until you remove it you will have to
# operate the previous ones manually

./sources/robrun.sh 7

# Upgrade the image

# apt update && apt upgrade will be run on the existing base image
# The image for laboratory 7 will be fully rebuilt

./sources/robbuild.sh 7 upgrade

# Fully upgrade the image

# The latest ROS image will be pulled
# The base and laboratory 7 images
# will be fully rebuilt

./sources/robbuild.sh 7 full-upgrade

Scripts

The list of all available helper scripts provided by this framework:

Name Path
robgo ./
robget ./materials
robshare ./solutions
robrun ./source
robbuild ./source

Go see help for each of them (<path><name>.sh without any arguments from the repository root directory)

More on scripts

In Linux, a script needs special permission to be executed. Grant it by typing chmod +x <path-to-script>
To run a script type <path-to-script> <argument1> <argument2> ...
As long as it is not an alias, remember about ./ and .sh

Used argument notation (one of the many others):

Notation Meaning
<lab-id> To be replaced by a value
[--rm] Optional
-a/-aq/--quiet Non-positional; may be combinable; double dash for full forms
upgrade|full-upgrade Mutually exclusive - pick one
(<docker-run-options>) Can be repeated multiple times

WSL configuration

GUI

Make sure you run the latest WSL version
You can either choose the default WSL X server or VcxSrv
The last one is much slower but provides a more Windows-like experience:
the windows are easier to interact with (moving, snapping, stacking)

GPU

Totally not required for these classes, but you can try it out

Devices

WSL provides a very limited amount of drivers
Therefore for something like webcam support, you will have to compile a custom WSL kernel
Also, you will need a tool like usbipd-win that will handle the control over your device to Linux
There is a video covering the whole process

About

A Bash Script framework for Docker providing basic conventions and helper scripts in the context of Robotics classes

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published