Skip to content
Snippets Groups Projects
Commit c80f9910 authored by Montaño Sarria, Andres Felipe's avatar Montaño Sarria, Andres Felipe
Browse files

Merge remote-tracking branch 'origin/main' into 2-improbing-installation-of-dependencies

parents c27232ea 17f7e6a4
No related branches found
No related tags found
1 merge request!2Resolve "Improbing installation of dependencies"
......@@ -37,6 +37,7 @@ RUN apt-get update && \
# ccmake
cmake-curses-gui \
direnv \
gawk \
gdb \
git \
git-lfs \
......@@ -54,26 +55,6 @@ RUN if [ "$EXT_SHELL" = "zsh" ]; \
apt-get -y install zsh; \
fi
# Install extra libs from .deb files
WORKDIR /tmp/srcs/
COPY /extra_libs/* ./
# Enviroment tools based on ubuntu version
RUN if [ -f "common_libs.txt" ]; \
then \
grep -v '^#' common_libs.txt | xargs dpkg -i ;\
fi
# Extra libs, e.g. vtk-7.1_20221201-1_amd64.deb
RUN if [ -f "${ROS_DISTRO}_libs.txt" ]; \
then \
grep -v '^#' ${ROS_DISTRO}_libs.txt | xargs dpkg -i ;\
fi
RUN rm -rf *
RUN apt-get --reinstall install -y libnotify-bin notify-osd
# Configure system to look for debian packages in the Artifactory repository
COPY auth.conf /etc/apt/auth.conf.d/tecnalia.conf
......@@ -106,6 +87,8 @@ RUN if [ "${ROS_DISTRO}" = "melodic" ]; \
python-osrf-pycommon\
python-vcstool; \
else\
if [ "${ROS_DISTRO}" = "noetic" ]; \
then \
apt-get update && \
apt-get -y install \
ipython3 \
......@@ -117,6 +100,7 @@ RUN if [ "${ROS_DISTRO}" = "melodic" ]; \
python3-pip \
# clang
clangd liblldb-dev libllvm-ocaml-dev python3-clang; \
fi \
fi
# Install ROS 1 tools
......@@ -149,8 +133,45 @@ RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \
RUN rm -rf *
# Install extra libs from .deb files
WORKDIR /tmp/srcs/
COPY /extra_libs/* ./
# Enviroment tools based on ubuntu version
RUN if [ -f "common_libs.txt" ]; \
then \
grep -v '^#' common_libs.txt | xargs dpkg -i ;\
fi
# Extra libs, e.g. vtk-7.1_20221201-1_amd64.deb
RUN if [ -f "${ROS_DISTRO}_libs.txt" ]; \
then \
grep -v '^#' ${ROS_DISTRO}_libs.txt | xargs dpkg -i ;\
fi
# Read the plugin list and copy the plugins to their destinations
RUN if [ -f "${ROS_DISTRO}_plugins.txt" ]; \
then \
while IFS= read -r line; \
do \
echo "Processing line: $line"; \
if [[ "$line" == \#* ]]; \
then \
echo "Skipping ${line}"; \
else \
plugin_name=$(echo "$line" | awk '{print $1}'); \
destination=$(echo "$line" | awk '{print $2}'); \
echo "Coping ${plugin_name} into ${destination}"; \
mkdir -p "$destination" && cp -r "$plugin_name" "$destination/"; \
fi; \
done < ${ROS_DISTRO}_plugins.txt ; \
fi
RUN rm -rf *
RUN apt-get --reinstall install -y libnotify-bin notify-osd
# Update this date to re-run the image final update
LABEL image.date=23-10-2023
LABEL image.date=25-10-2023
# Update final image
RUN apt-get update \
......
# list of files and destination folders
librealsense_gazebo_plugin.so /usr/lib/x86_64-linux-gnu/gazebo-11/plugins
File added
# docker common commands
export dockerfiles_DIR=~/srcs/development_environment/dockerfiles;
alias dim="docker images"
alias dpsa="docker ps -a"
alias dps="docker ps"
alias drm="docker rm"
alias drmi="docker rmi"
alias dsp="docker system prune --all"
alias dimp="docker image prune"
# Build docker image
# usage: dockbuild {noetic, melodic}
function dockbuild(){
if [ $# -lt 1 ]; then
echo "Usage: dockbuild <ROS_DISTRO> [build_args]"
echo "build_args:"
echo " SHELL - zsh (default) or bash"
return 1
fi
cd $dockerfiles_DIR;
if [ $# -lt 2 ]; then
echo "Building ROS_DISTRO:"$1 "with SHELL_VERISON: zsh"
docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg SHELL="zsh" -f devenv.Dockerfile .
else
if [ $2 = "bash" ]; then
echo "Building ROS_DISTRO:"$1 "with SHELL_VERISON:"$2
docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg SHELL=$2 -f devenv.Dockerfile .
else
echo "SHELL_VERISON:"$2 "not supported"
fi
fi
}
# Run container with rocker
# usage: rundock {noetic, melodic} [{remodel_ws, odin_ws}] [cmd]
# ToDo Add extra parameters by arg
# To share docker --volume /var/run/docker.sock:/var/run/docker.sock:ro
# To share video (usb-cam) --volume /dev/video0:/dev/video0
function dockrun() {
# Check if the image exist
if [[ "$(docker images -q devenv:$1 2> /dev/null)" == "" ]]; then
# build the image
dockbuild $1
fi
# Check if the container exist
if [[ $(docker ps -aq -f name=$1) ]]; then
# Attach to conayiner
docker exec -it $1 bash -c "cd ~/ros/$1/$2 && $ext"
else
# Launch container
cd ~/ros/$1/$2;
rocker --home --ssh --git --user --privileged --nvidia --x11 --network host --name $1 devenv:$1 $3
fi
}
# Remove all stoped containers
function drma() {
drm $(docker ps -a -f status=exited -q)
}
# Remove all unused or dangling immages
function drmui(){
drmi $(dim --filter "dangling=true" -q --no-trunc)
}
# Stop and remove
function dsr() {
docker stop $1;
docker rm $1
}
# function runpythonsyntax(){
# rocker --home --name python_syntax tecnalia-docker-dev.artifact.tecnalia.com/docker:git
# }
# function runremodel() {
# rocker --x11 --nvidia --privileged --network=host --name remodel_docker --oyr-run-arg " -v iiwa_state_recorder:/home/remodel/iiwa_state_recorder -v /home/andres/test/remodel_shared:/home/remodel/remodel_shared" -- remodel_app:melodic bash -c "'roslaunch remodel_app remodel_app.launch use_sim:=true docker:=true skill_manager:=true collision_detector:=true ui:=true cad:=true joystick:=false'"
# }
# function docrun() {
# rocker --nvidia --pulse --x11 --volume /dev/video0:/dev/video0 --privileged --oyr-run-arg " -v odin_robot_volume:/root/" --name odin_robot --network host odin_robot:melodic $1
# }
# function runodin() {
# rocker --nvidia --pulse --x11 --privileged --volume /dev/video0:/dev/video0 --name odin_melodic --network host devenv:melodic $1
# }
#DOCKER
alias dexec='f(){ docker exec -w /root/ --detach-keys="ctrl-@" -e DISPLAY=$DISPLAY -it $1 /bin/bash -c "terminator --no-dbus"; unset -f f; }; f'
alias dexec_nt='f(){ docker exec --detach-keys="ctrl-@" -e DISPLAY=$DISPLAY -it $1 /bin/bash ; unset -f f; }; f'
alias dstart='f(){ docker start $1; dexec $1; unset -f f; }; f'
# Run using same X and .ssh folder
alias drun='f(){ docker run -it -e DISPLAY=$DISPLAY --detach-keys="ctrl-@" -v /tmp/.X11-unix:/tmp/.X11-unix -v ~/.ssh:/root/.ssh:ro -v ~/docker_share/:/root/docker_share/ --net=host --name $2 $1; unset -f f; }; f'
alias drun_nvidia='f(){ docker run -it --name $2 --privileged \
--net=host \
--env=NVIDIA_VISIBLE_DEVICES=all \
--env=NVIDIA_DRIVER_CAPABILITIES=all \
--env=DISPLAY \
--env=QT_X11_NO_MITSHM=1 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--gpus all \
--device /dev/snd \
-e NVIDIA_VISIBLE_DEVICES=0 \
--detach-keys="ctrl-@" \
-v ~/.ssh:/root/.ssh:ro \
-v ~/docker_share/:/root/docker_share/ \
$1 /bin/bash; unset -f f; }; f'
......@@ -9,11 +9,22 @@ alias drmi="docker rmi"
alias dsp="docker system prune --all"
alias dimp="docker image prune"
# Determine shell extension
if [ -z $SHELL ]; then
echo "SHELL not set"
export SHELL=/usr/bin/zsh
ext=$(basename ${SHELL});
else
ext=$(basename ${SHELL});
fi
# Build docker image
# usage: dockbuild {noetic, melodic}
function dockbuild(){
if [ $# -lt 1 ]; then
echo "Usage: dockbuild <ROS_DISTRO> [build_args]"
echo "ROS_DISTRO:"
echo " melodic, noetic, humble, etc."
echo "build_args:"
echo " EXT_SHELL - zsh (default) or bash"
return 1
......@@ -39,7 +50,23 @@ function dockbuild(){
# ToDo Add extra parameters by arg
# To share docker --volume /var/run/docker.sock:/var/run/docker.sock:ro
# To share video (usb-cam) --volume /dev/video0:/dev/video0
# To share pcan --volume /dev/pcanusb32:/dev/pcanusb32
function dockrun() {
if [ $# -lt 1 ]; then
echo "Usage: dockrun <ROS_DISTRO> [posicional options]"
echo "ROS_DISTRO:"
echo " melodic, noetic, humble, etc."
echo "Options:"
echo " Passing 1 option --> path_to_workspace. E.g., dockrun humble mairon_ws"
echo " Passing 2 options --> path_to_workspace + extra_config. E.g., dockrun humble mairon_ws video"
echo " extra_config: pcan, video, pcan_video"
echo "Examples:"
echo "dockrun humble mairon_ws"
echo "dockrun noetic neurondones_ws pcan_video"
echo "dockrun melodic odinrobot_ws video"
return 1
fi
# Check if the image exist
if [[ "$(docker images -q devenv:$1 2> /dev/null)" == "" ]]; then
# build the image
......@@ -48,12 +75,55 @@ function dockrun() {
# Check if the container exist
if [[ $(docker ps -aq -f name=$1) ]]; then
# Attach to conayiner
# Attach to container
if [ $# -lt 2 ]; then
docker exec -it $1 bash -c "cd ~/ros/$1 && $ext"
else
docker exec -it $1 bash -c "cd ~/ros/$1/$2 && $ext"
fi
else
# Launch container
cd ~/ros/$1/$2;
rocker --home --ssh --git --user --privileged --nvidia --x11 --network host --name $1 devenv:$1 $3
if [ $# -lt 4 ]; then
rocker --home --ssh --git --user --privileged --nvidia --x11 --network host --name $1 devenv:$1
else
if [ $3 = "pcan" ]; then
rocker --home --ssh --git --user --privileged --nvidia --x11 --volume /dev/pcanusb32:/dev/pcanusb32 --network host --name $1 devenv:$1
else
fi
fi
fi
}
function dockexec() {
if [ $# -lt 1 ]; then
echo "Usage: dockexec <ROS_DISTRO> [workspace] [command]"
echo "ROS_DISTRO:"
echo " melodic, noetic, humble, etc."
echo "Example:"
echo "dockexec noetic neurondones_ws roscore"
return 1
fi
# Check if the image exist
if [[ "$(docker images -q devenv:$1 2> /dev/null)" == "" ]]; then
# build the image
echo "Docker image for ${1} does not exist"
return 1
fi
# Check if the container exist
if [[ $(docker ps -aq -f name=$1) ]]; then
# Attach to container
if [ $# -lt 2 ]; then
docker exec -it $1 bash -c "cd ~/ros/$1 && $ext"
else
docker exec -it $1 bash -c "cd ~/ros/$1/$2 && $ext"
fi
else
# Launch container
echo "Container for ${1} does not exist"
fi
}
......
###################################################################
# ROS aliases and functions
###################################################################
# Define ROS_DISTRO before source ROS on native OS
# if [ -z $ROS_DISTRO ]; then export ROS_DISTRO=noetic; fi
if [[ -z "${ROS_DISTRO}" ]]; then
ROS_DIR=/opt/ros
if [ -d "$ROS_DIR" ];
then
export ROS_DISTRO=$(basename $(find /opt/ros/* -maxdepth 0 -type d | head -1))
else
unset ROS_DISTRO
fi
fi
# Determine shell extension
if [ -z $SHELL ]; then echo "SHELL not set"; else ext=$(basename ${SHELL}); fi
# Source rosmon
function smon(){
if [[ -f "/opt/ros/${ROS_DISTRO}/etc/catkin/profile.d/50-rosmon.${ext}" ]]; then
source /opt/ros/${ROS_DISTRO}/etc/catkin/profile.d/50-rosmon.${ext}
fi
}
# cd to the root of the workspace
function roshome(){
roscd && cd ..
ROS_HOME=${PWD}
}
# Source the current workspace
function sourcews(){
source ./devel/setup.${ext} && smon
}
# Source the current workspace
function sourceros(){
source /opt/ros/${ROS_DISTRO}/setup.${ext} && smon
ROS_HOME="/opt/ros/${ROS_DISTRO}/"
}
# Source the current workspace
function sourcethis(){
pwd_st=${PWD}
roshome && sourcews
echo "Sourcing: ${ROS_HOME}"
cd ${pwd_st}
}
# Automatic catkin build
function cb() {
pwd_cb=${PWD}
roshome
catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release -- "$@"
sourcethis
cd ${pwd_cb}
}
# Clean workspace (delete the generated folders, then catkin build)
function cbclean(){
roshome && rm -rf build devel install && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release
}
# Initialize catkin workspace, configure and build it
function cib(){
catkin init && catkin config --extend /opt/ros/${ROS_DISTRO} && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release
}
# Run ci locally
function runci(){
# check if exist .rosinstall file
if [ -f ./.rosinstall ]; then
echo ".rosinstall in package"
find ../ -name run_ci -exec bash {} ROS_DISTRO="$@" DOCKER_IMAGE=tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:"$@" UPSTREAM_WORKSPACE=.rosinstall \;
else
echo "No .rosinstall in package"
find ../ -name run_ci -exec bash {} ROS_DISTRO="$@" DOCKER_IMAGE=tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:"$@" \;
fi
}
# if a new terminal starts in a ws, auto source it (useful for vscode)
if [ -z ${ROS_DISTRO+x} ]; then ;
else
pwd_init=${PWD}
cropped=${PWD#${HOME}/ros/${ROS_DISTRO}/}
WS_name=${cropped%%/*}
WS_path=${HOME}/ros/${ROS_DISTRO}/${WS_name}
FILE=${WS_path}/devel/setup.${ext}
# if PWD belongs to ROS ws then source it
if [[ -f $FILE ]]; then
cd ${WS_path}
source $FILE
cd ${pwd_init}
ROS_HOME=${WS_path}
else
sourceros
fi
fi
alias sc=sourcethis
\ No newline at end of file
......@@ -88,7 +88,7 @@ function cbclean(){
then
roshome && rm -rf build devel install && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release
else
rm -rf build devel install && cb
rm -rf build log install && cb "$@"
fi
}
......
# Determine shell extension
if [ -z $SHELL ]; then
echo "SHELL not set"
export SHELL=/usr/bin/zsh
ext=$(basename ${SHELL});
else
ext=$(basename ${SHELL});
fi
if command -v lsd &> /dev/null
then
# Directories
alias ll='lsd -lh --group-dirs=first'
alias la='lsd -a --group-dirs=first'
alias l='lsd --group-dirs=first'
alias lla='lsd -lha --group-dirs=first'
alias ls='lsd --group-dirs=first'
else
alias ll='ls -lh'
alias la='ls -a'
alias l='ls'
alias lla='ls -lha'
alias ls='ls'
fi
if command -v bat &> /dev/null
then
# Files
alias cat='bat'
fi
# Python
if command -v ipython &> /dev/null
then
alias ipy='ipython'
fi
alias mountT='sudo mount -t cifs //tri.lan/tri /mnt/T --verbose -o username=110343,password=Bageera\#1983,workgroup=TRI.LAN'
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
#zmodload zsh/zprof
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
source "$HOME/.homesick/repos/homeshick/homeshick.sh"
fpath=($HOME/.homesick/repos/homeshick/completions $fpath)
source ~/antigen.zsh
antigen use oh-my-zsh
antigen theme romkatv/powerlevel10k
antigen bundle docker
antigen bundle git
antigen bundle globalias
antigen bundle last-working-dir
antigen bundle sudo
antigen bundle zsh-users/zsh-history-substring-search
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle wfxr/forgit
antigen bundle paulirish/git-open
antigen bundle popstas/zsh-command-time
antigen bundle MichaelAquilina/zsh-auto-notify
antigen bundle MichaelAquilina/zsh-you-should-use
antigen bundle zsh-users/zsh-autosuggestions
antigen apply
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=0'
# command-line fuzzy finder
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
source $HOME/.init_shell
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
#zprof
export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --no-ignore-vcs'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
#export FZF_ALT_C_COMMAND="fd -t d --hidden --follow --exclude \".git\" . $HOME"
export FZF_ALT_C_COMMAND="fd -t d --hidden --follow --exclude \".git\" ."
# Create a cache folder if it isn't exists
if [ ! -d "$HOME/.cache/zsh" ]; then
mkdir -p $HOME/.cache/zsh
fi
# Define a custom file for compdump
export ZSH_COMPDUMP="$HOME/.cache/zsh/zcompdump-$HOST-$ZSH_VERSION"
# User configuration
export EDITOR="code -r"
# Include dotfiles
source ${HOME}/srcs/development_environment/dotfiles/system.bash
source ${HOME}/srcs/development_environment/dotfiles/git.bash
source ${HOME}/srcs/development_environment/dotfiles/docker.bash
source ${HOME}/srcs/development_environment/dotfiles/ros.bash
# To add direnv app
# eval "$(direnv hook zsh)"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Finalize Powerlevel10k instant prompt. Should stay at the bottom of ~/.zshrc.
(( ! ${+functions[p10k-instant-prompt-finalize]} )) || p10k-instant-prompt-finalize
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment