Skip to content

Commit

Permalink
Merge commit '33d78d891f05452bffc2d8a2509cd2dd70dae6c7'
Browse files Browse the repository at this point in the history
  • Loading branch information
SeniorKullken committed Aug 23, 2024
2 parents 4fe47f7 + 33d78d8 commit 29d62b7
Show file tree
Hide file tree
Showing 12 changed files with 239 additions and 52 deletions.
13 changes: 13 additions & 0 deletions pet-mk-iv-simulation/.bash_history
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source ~/ws_ros1/devel/setup.bash
roslaunch pet_mk_iv_simulation pet_play_yard-01.launch
roslaunch pet_mk_iv_simulation pet_play_yard-02.launch
roslaunch pet_mk_iv_simulation pet_play_yard-02.launch
roslaunch pet_mk_iv_simulation testrun_01_avoid-wall-line-stop.launch
roslaunch pet_mk_iv_simulation spawn_pet_mk_iv.launch
rosrun pet_mk_iv_mission_control testrun_00_line-stop.py
rosrun pet_mk_iv_mission_control testrun_01_avoid-wall-line-stop.py
rosrun pet_mk_iv_mission_control rosrun pet_mk_iv_mission_control
roslaunch pet_mk_iv_description rviz.launch
rqt_graph
env|grep ROS
env|grep GAZEBO
33 changes: 25 additions & 8 deletions pet-mk-iv-simulation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ RUN apt-get update &&\
apt-get install -y python3-catkin-tools &&\
apt-get install -y ros-noetic-teleop-twist-keyboard &&\
apt-get install -y ros-noetic-xacro &&\
apt-get install -y python3-osrf-pycommon &&\
rm -rf /var/lib/apt/lists/*
RUN pip3 install osrf-pycommon
# RUN pip3 install osrf-pycommon

# Lets make a Python/Python2 name-compatible executable of Python3
USER root
RUN ln -s /usr/bin/python3.8 /usr/bin/python

# Install Neofetch (not neccesary but fancy :-)
RUN sudo apt update -y &&\
USER root
RUN apt update -y &&\
apt -y install neofetch &&\
echo 'neofetch' >> ${HOMEDIR}/.bashrc &&\
rm -rf /var/lib/apt/lists/*
Expand All @@ -88,7 +91,8 @@ WORKDIR ${HOMEDIR}/ws_ros1/src
RUN git clone https://github.com/Pet-Series/Pet-Mk-IV.git &&\
git clone https://github.com/Pet-Series/pet_mk_iv_simulation.git
WORKDIR ${HOMEDIR}/ws_ros1
RUN catkin_make
RUN source /opt/ros/noetic/setup.bash && catkin init
# catkin_make

# Build the ROS1 workspace
WORKDIR ${HOMEDIR}/ws_ros1
Expand All @@ -103,20 +107,33 @@ RUN source /opt/ros/noetic/setup.bash &&\
RUN mkdir ${HOMEDIR}/.gazebo
COPY gui.ini ${HOMEDIR}/.gazebo/gui.ini

# Recreate/Pre-load the '.bash_history' for commands
USER ${DOCKERUSER}
WORKDIR ${HOMEDIR}
COPY .bash_history ${HOMEDIR}/.bash_history
USER root
RUN chmod 600 ${HOMEDIR}/.bash_history && chown ${DOCKERUSER} ${HOMEDIR}/.bash_history && sudo chgrp ${DOCKERUSER} ${HOMEDIR}/.bash_history

# Adding stuff to >> $~/.bashrc
USER ${DOCKERUSER}
RUN echo '# Setting up my own fancy Terminal Prompt :-)' >> ${HOMEDIR}/.bashrc &&\
echo 'export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;37;44m\]🐳${DOCKERPROMPT}\[\033[00m\]_\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\\$ "' >> ${HOMEDIR}/.bashrc

# Setting up ROS1/Noetic and Gazebo, by adding stuff to >> $~/.bashrc
USER ${DOCKERUSER}
RUN echo "# Setting up ROS1/Noetic and Gazebo" >> ${HOMEDIR}/.bashrc &&\
echo 'source /opt/ros/noetic/setup.bash' >> ${HOMEDIR}/.bashrc &&\
echo 'source ${HOMEDIR}/ws_ros1/devel/setup.bash' >> ${HOMEDIR}/.bashrc &&\
echo "alias source_noetic='source /opt/ros/noetic/setup.bash'" >> ${HOMEDIR}/.bashrc &&\
echo "alias source_noetic='source /opt/ros/noetic/setup.bash'" >> ${HOMEDIR}/.bashrc &&\
echo "alias source_pet='source ${HOMEDIR}/ws_ros1/devel/setup.bash'" >> ${HOMEDIR}/.bashrc &&\
echo "export GAZEBO_RESOURCE_PATH=$HOME/ws_ros1/src/pet_mk_iv_simulation/worlds/:$GAZEBO_RESOURCE_PATH" >> ${HOMEDIR}/.bashrc &&\
echo "export GAZEBO_MODEL_PATH=$HOME/ws_ros1/src/pet_mk_iv_simulation/models:$GAZEBO_MODEL_PATH" >> ${HOMEDIR}/.bashrc
echo "export GAZEBO_RESOURCE_PATH=$HOME/ws_ros1/src/pet_mk_iv_simulation/worlds/:\${GAZEBO_RESOURCE_PATH}" >> ${HOMEDIR}/.bashrc &&\
echo "export GAZEBO_MODEL_PATH=/usr/share/gazebo-11/models" >> ${HOMEDIR}/.bashrc &&\
echo "export GAZEBO_MODEL_PATH=$HOME/ws_ros1/src/pet_mk_iv_simulation/models:\${GAZEBO_MODEL_PATH}" >> ${HOMEDIR}/.bashrc

# Setup exit condtions
USER root
RUN chmod 700 ${HOMEDIR}/.bashrc
USER ${DOCKERUSER}
WORKDIR ${HOMEDIR}/ws_ros1
CMD ["/bin/bash"]
ENTRYPOINT ["/bin/bash", "-c"]
# CMD bash
# ENTRYPOINT /ros_entrypoint.sh
29 changes: 20 additions & 9 deletions pet-mk-iv-simulation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ ROS1 repository in the https://github.com/Pet-Series Git-Organizations.</br>

Containing a Pet-Mk.IV ROS1-package / data for Gazebo & RViz
- FROM osrf/ros:noetic-desktop-full-focal (amd64)
- Ubuntu 20.04.6 LTS
- ROS1 Noetic full desktop
- Ubuntu 20.04.6 LTS (aka. "Focal Fossa")
- ROS1 Noetic full desktop (aka. "Noetic Ninjemys")

## **What is this folder for?** ##
Docker stuff neccesary to be able to build & run robot simulation of Pet-Mk.IV, using Gazebo.</br>
- https://github.com/Pet-Series/Pet-Mk-IV.git
- https://github.com/Pet-Series/pet_mk_iv_simulation.git <-This repo.
- https://hub.docker.com/repository/docker/kullken/ros1_amd64 < Look for tag `pet-mk-iv-simulation`
- https://github.com/Pet-Series/pet_mk_iv_simulation.git
- https://github.com/Pet-Series/pet_docker `<- This Repo.`
- https://hub.docker.com/repository/docker/kullken/ros1_amd64 `<- Look for tag 'pet-mk-iv-simulation'`
<table>
<tr>
<td>
Expand All @@ -31,12 +32,13 @@ Docker stuff neccesary to be able to build & run robot simulation of Pet-Mk.IV,


# Setup
## **How do I get set up?** ##
```console
ubuntu@host:~$ docker pull kullken/ros1_amd64:pet-mk-iv-simulation
## **How do I set up?** ##
```bash
user@host:~$ docker pull kullken/ros1_amd64:pet-mk-iv-simulation
```
```console
ubuntu@host:~$ docker run \
```bash
user@host:~$ xhost local:docker
user@host:~$ docker run \
-it \
--rm \
--network=host \
Expand All @@ -46,3 +48,12 @@ ubuntu@host:~$ docker run \
--name pet-mk-iv-simulation_container \
kullken/ros1_amd64:pet-mk-iv-simulation
```
```bash
🐳pet@docker:~$ roslaunch pet_mk_iv_simulation testrun_01_avoid-wall-line-stop.launch
```
```bash
user@host:~$ docker exec -it pet-mk-iv-simulation_container bash
```
```bash
🐳pet@docker:~$ roslaunch pet_mk_iv_description rviz.launch
```
67 changes: 38 additions & 29 deletions pet-mk-iv-simulation/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,57 @@
# Launch [Builds, (re)creates, starts] with:
# $ docker compose build
# $ docker compose build --no-cache
# $ docker compose up -d

# Connect shell/bash by:
# $ docker exec -it pet-mk-iv-simulation_container bash

# Remove
# $ docker compose down

version: "3"
# Launch [Builds, (re)creates, starts] using $ docker compose
#
# Prerequisite - On docker host:
# I) That '$ xhost local:docker' is run before container is started - To enable GUI/X11 applications inside container
#----------------------
# Commands:
# 1) Enable X11 from inside the Docker Image/Container
# $ xhost local:docker
#
# 2a) Create/Start Container from Image :
# $ docker compose up --detach --build
# 2b) List running/active/paused
# $ docker compose ps -all
#
# 3) Connect bash to existing/new container:
# $ docker exec -it jazzy-full-pico-container bash
# OR
# $ ./docker_exec.sh
#
# 4) Stop, or remove, your container once you've finished with them.
# $ docker conpose pause / unpause
# $ docker compose stop / start
# $ docker compose down (stop & remove container)
# $ docker container kill pet-mk-iv-simulation_container
# $ docker container prune
#----------------------
# Maintainer: stefan.kull@gmail.com
# Licens: MIT
# https://github.com/Pet-Series
#
# "noetic" = ROS1
# "focal" = Ubuntu 20.04
#----------------------
# More info: https://github.com/Pet-Series/pet_docker
# More info: https://hub.docker.com/repositories/kullken
# More info: https://hub.docker.com/repository/docker/kullken/ros1_amd64
services:
ros1:
build: .
image: kullken/ros1_amd64:pet-mk-iv-simulation
container_name: pet-mk-iv-simulation_container
labels:
- "se.pet-series.description=ROS1 Noetic for Pet-Mk.IV(label)"
deploy:
labels:
- "se.pet-series.description=ROS1 Noetic for Pet-Mk.IV(service)"
build: .
environment:
- DISPLAY=${DISPLAY}
privileged: true
# devices:
# - "/dev/ttyUSB0:/dev/ttyUSB0" # USB
# - "/dev/gpiomem:/dev/gpiomem" # GPIO
# - "/dev/i2c-1:/dev/i2c-1" # I2C-1
# - "/dev/i2c-2:/dev/i2c-2" # I2C-2
# - "/dev/spidev0.0:/dev/spidev0.0" # SPI.0
# - "/dev/spidev0.1:/dev/spidev0.1" # SPI.1
network_mode: "host"
# networks:
# - hostnet
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
# - /home/pi/ws_ros2:/home/pet/ws_ros2:rw
stdin_open: true # docker run -i
tty: true # docker run -t
# restart: always
# restart: unless-stopped
# command: [ "roscore" ]

#networks:
# hostnet:
# external: true
# name: host
# command: [ "roscore" ]
49 changes: 49 additions & 0 deletions pet-mk-iv-simulation/docker-compose_testrun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Launch [Builds, (re)creates, starts] with:
# $ docker compose --file docker-compose_testrun.yml up
#
# Connect shell/bash by:
# $ xhost local:docker
# $ docker exec -it pet-mk-iv-simulation_container bash
#
# Remove
# $ docker compose down
#----------------------
# Maintainer: stefan.kull@gmail.com
# Licens: MIT
# https://github.com/Pet-Series

# "noetic" = ROS1
# "focal" = Ubuntu 20.04

# More info: https://github.com/Pet-Series/pet_docker
# More info: https://hub.docker.com/repositories/kullken
# More info: https://hub.docker.com/repository/docker/kullken/ros1_amd64
services:
spawn-world:
user: pet
build: .
image: kullken/ros1_amd64:pet-mk-iv-simulation
container_name: pet-mk-iv-simulation_world_container
labels:
- "se.pet-series.description=ROS1 Noetic for Pet-Mk.IV(label)"
deploy:
labels:
- "se.pet-series.description=ROS1 Noetic for Pet-Mk.IV(service)"
environment:
- DISPLAY=${DISPLAY}
privileged: true
network_mode: "host"
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
stdin_open: true # docker run -i
tty: true # docker run -t
#command: bash -c "ls -l && pwd && whoami"
#command: bash
#command: roslaunch pet_mk_iv_simulation spawn_pet_mk_iv.launch
#command: source ~/.bashrc && roslaunch pet_mk_iv_description rviz.launch
#command: rosrun pet_mk_iv_mission_control testrun_01_avoid-wall-line-stop.py
#entrypoint: bash -c "~/.bashrc && roslaunch pet_mk_iv_simulation pet_play_yard-02.launch"
#entrypoint: bash -c "source ~/ws_ros1/devel/setup.bash && roslaunch pet_mk_iv_simulation pet_play_yard-02.launch"
#entrypoint: bash -c "source /home/pet/ws_ros1/devel/setup.bash && roslaunch pet_mk_iv_simulation pet_play_yard-03.launch"
#entrypoint: bash -c "../.bashrc && roslaunch pet_mk_iv_description rviz.launch"
entrypoint: bash
12 changes: 11 additions & 1 deletion pet-mk-iv-simulation/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/bash
# Build Dockerfile in the same directory
# https://hub.docker.com/repository/docker/kullken/ros1_amd64
#----------------------
# Maintainer: stefan.kull@gmail.com
# Licens: MIT
# https://github.com/Pet-Series

# "noetic" = ROS1
# "focal" = Ubuntu 20.04

# More info: https://github.com/Pet-Series/pet_docker
# More info: https://hub.docker.com/repositories/kullken
# More info: https://hub.docker.com/repository/docker/kullken/ros1_amd64
docker build --tag kullken/ros1_amd64:pet-mk-iv-simulation .
14 changes: 14 additions & 0 deletions pet-mk-iv-simulation/docker_exec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# Start bash in existing container (Status Up/Paused).
#----------------------
# Maintainer: stefan.kull@gmail.com
# Licens: MIT
# https://github.com/Pet-Series

# "noetic" = ROS1
# "focal" = Ubuntu 20.04

# More info: https://github.com/Pet-Series/pet_docker
# More info: https://hub.docker.com/repositories/kullken
# More info: https://hub.docker.com/repository/docker/kullken/ros1_amd64
docker exec -it pet-mk-iv-simulation_container bash
17 changes: 17 additions & 0 deletions pet-mk-iv-simulation/docker_execs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# Start bash in existing container (Status Up/Paused).
#----------------------
# Maintainer: stefan.kull@gmail.com
# Licens: MIT
# https://github.com/Pet-Series

# "noetic" = ROS1
# "focal" = Ubuntu 20.04

# More info: https://github.com/Pet-Series/pet_docker
# More info: https://hub.docker.com/repositories/kullken
# More info: https://hub.docker.com/repository/docker/kullken/ros1_amd64
docker exec -it pet-mk-iv-simulation_container bash -c "source /home/pet/ws_ros1/devel/setup.bash && roslaunch pet_mk_iv_simulation pet_play_yard-02.launch"
docker exec -it pet-mk-iv-simulation_container bash -c "source /home/pet/ws_ros1/devel/setup.bash && roslaunch pet_mk_iv_simulation spawn_pet_mk_iv.launch"
docker exec -it pet-mk-iv-simulation_container bash -c "source /home/pet/ws_ros1/devel/setup.bash && roslaunch pet_mk_iv_description rviz.launch"
docker exec -it pet-mk-iv-simulation_container bash -c "source /home/pet/ws_ros1/devel/setup.bash && rosrun pet_mk_iv_mission_control testrun_01_avoid-wall-line-stop.py"
16 changes: 16 additions & 0 deletions pet-mk-iv-simulation/docker_kill.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Stop and remove Docker-container
#----------------------
# Maintainer: stefan.kull@gmail.com
# Licens: MIT
# https://github.com/Pet-Series

# "noetic" = ROS1
# "focal" = Ubuntu 20.04

# More info: https://github.com/Pet-Series/pet_docker
# More info: https://hub.docker.com/repositories/kullken
# More info: https://hub.docker.com/repository/docker/kullken/ros1_amd64
docker container stop pet-mk-iv-simulation_container
docker container kill pet-mk-iv-simulation_container
docker container rm pet-mk-iv-simulation_container
10 changes: 8 additions & 2 deletions pet-mk-iv-simulation/docker_push.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
# Push a Docker Image to DockerHub repository.
# https://hub.docker.com/repositories/kullken
# https://hub.docker.com/repository/docker/kullken/ros1_amd64
#----------------------
# Maintainer: stefan.kull@gmail.com
# Licens: MIT
# https://github.com/Pet-Series

# "noetic" = ROS1
# "focal" = Ubuntu 20.04

# docker login -u "kullken" -p "@@@@@@@@" docker.io
docker push kullken/ros1_amd64:pet-mk-iv-simulation
17 changes: 14 additions & 3 deletions pet-mk-iv-simulation/docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
#!/bin/bash
# Run docker image from https://hub.docker.com/repository/docker/kullken/ros1_amd64

#
# Connect to, an running, container using shell/bash by:
# $ docker exec -it pet-mk-iv-simulation_container bash
# $ docker exec -it pet-mk-iv-simulation_container bash
#----------------------
# Maintainer: stefan.kull@gmail.com
# Licens: MIT
# https://github.com/Pet-Series

# "noetic" = ROS1
# "focal" = Ubuntu 20.04

# More info: https://github.com/Pet-Series/pet_docker
# More info: https://hub.docker.com/repositories/kullken
xhost local:docker
docker run \
-it \
--rm \
--detach \
--network=host \
--privileged \
--volume="/tmp/.X11-unix:/tmp/.X11-unix" \
Expand Down
Loading

0 comments on commit 29d62b7

Please sign in to comment.