Skip to content

Commit 5704d64

Browse files
Use Fixposition SDK, add devcontainer config, cleanup (#78)
* Small update for the driver ;) --------- Co-authored-by: Facundo Garcia <[email protected]>
1 parent dd25d27 commit 5704d64

File tree

222 files changed

+8192
-19315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+8192
-19315
lines changed

.devcontainer/.bash_history.d/.gitkeep

Whitespace-only changes.

.devcontainer/.bash_logout

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ~/.bash_logout: executed by bash(1) when login shell exits.
2+
3+
# save history
4+
history -a
5+
6+
# when leaving the console clear the screen to increase privacy
7+
if [ "$SHLVL" = 1 ]; then
8+
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
9+
fi

.devcontainer/.bashrc

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# ~/.bashrc: executed by bash(1) for non-login shells.
2+
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
3+
# for examples
4+
5+
# If not running interactively, don't do anything
6+
case $- in
7+
*i*) ;;
8+
*) return;;
9+
esac
10+
11+
# don't put duplicate lines or lines starting with space in the history.
12+
# See bash(1) for more options
13+
HISTCONTROL="ignoredups:erasedups:ignorespace"
14+
15+
# append to the history file, don't overwrite it
16+
shopt -s histappend
17+
18+
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
19+
HISTSIZE=10000
20+
HISTFILESIZE=10000000
21+
HISTFILE=/home/fpsdk/.bash_history.d/history
22+
23+
# Disable history ! expansion
24+
set +H
25+
26+
export RSYNC_RSH=ssh
27+
export PAGER="less -R -i -x 4 -+C"
28+
export PERLDOC_PAGER="less -R -i -x 4 -+C"
29+
export LESSCHARSET=UTF-8
30+
export EDITOR='vim'
31+
export GIT_EDITOR=vim
32+
33+
# nicely coloured man pages
34+
export LESS_TERMCAP_mb=$'\E[01;31m'
35+
export LESS_TERMCAP_md=$'\E[01;31m'
36+
export LESS_TERMCAP_me=$'\E[0m'
37+
export LESS_TERMCAP_se=$'\E[0m'
38+
export LESS_TERMCAP_so=$'\E[01;44;33m'
39+
export LESS_TERMCAP_ue=$'\E[0m'
40+
export LESS_TERMCAP_us=$'\E[01;32m'
41+
42+
export LESS="FRSX"
43+
44+
# N.B. -R must be first or lesspipe.sh will be confused
45+
# warning: -R not compatible with +F (follow mode)!
46+
alias less='less -R -i -x 4 -S'
47+
48+
# Enable core dumps (does it?)
49+
ulimit -c 1048576
50+
51+
# check the window size after each command and, if necessary,
52+
# update the values of LINES and COLUMNS.
53+
shopt -s checkwinsize
54+
55+
# If set, the pattern "**" used in a pathname expansion context will
56+
# match all files and zero or more directories and subdirectories.
57+
#shopt -s globstar
58+
59+
# make less more friendly for non-text input files, see lesspipe(1)
60+
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
61+
62+
# set variable identifying the chroot you work in (used in the prompt below)
63+
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
64+
debian_chroot=$(cat /etc/debian_chroot)
65+
fi
66+
67+
# set a fancy prompt (non-color, unless we know we "want" color)
68+
case "$TERM" in
69+
xterm-color|*-256color) color_prompt=yes;;
70+
esac
71+
72+
# uncomment for a colored prompt, if the terminal has the capability; turned
73+
# off by default to not distract the user: the focus in a terminal window
74+
# should be on the output of commands, not on the prompt
75+
#force_color_prompt=yes
76+
77+
if [ -n "$force_color_prompt" ]; then
78+
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
79+
# We have color support; assume it's compliant with Ecma-48
80+
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
81+
# a case would tend to support setf rather than setaf.)
82+
color_prompt=yes
83+
else
84+
color_prompt=
85+
fi
86+
fi
87+
88+
if [ "$color_prompt" = yes ]; then
89+
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
90+
else
91+
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
92+
fi
93+
unset color_prompt force_color_prompt
94+
95+
# If this is an xterm set the title to user@host:dir
96+
case "$TERM" in
97+
xterm*|rxvt*)
98+
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
99+
;;
100+
*)
101+
;;
102+
esac
103+
104+
# enable color support of ls and also add handy aliases
105+
if [ -x /usr/bin/dircolors ]; then
106+
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
107+
alias ls='ls --color=auto'
108+
#alias dir='dir --color=auto'
109+
#alias vdir='vdir --color=auto'
110+
111+
alias grep='grep --color=auto'
112+
alias fgrep='fgrep --color=auto'
113+
alias egrep='egrep --color=auto'
114+
fi
115+
116+
# colored GCC warnings and errors
117+
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
118+
119+
# some more ls aliases
120+
alias ll='ls -alF'
121+
alias la='ls -A'
122+
alias l='ls -CF'
123+
alias rm='rm -i'
124+
alias mv='mv -i'
125+
126+
# Add an "alert" alias for long running commands. Use like so:
127+
# sleep 10; alert
128+
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
129+
130+
# Alias definitions.
131+
# You may want to put all your additions into a separate file like
132+
# ~/.bash_aliases, instead of adding them here directly.
133+
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
134+
135+
if [ -f ~/.bash_aliases ]; then
136+
. ~/.bash_aliases
137+
fi
138+
139+
# enable programmable completion features (you don't need to enable
140+
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
141+
# sources /etc/bash.bashrc).
142+
if ! shopt -oq posix; then
143+
if [ -f /usr/share/bash-completion/bash_completion ]; then
144+
. /usr/share/bash-completion/bash_completion
145+
elif [ -f /etc/bash_completion ]; then
146+
. /etc/bash_completion
147+
fi
148+
fi
149+
150+
if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
151+
# https://github.com/magicmonty/bash-git-prompt
152+
GIT_PROMPT_THEME=fpsdk
153+
source ~/.bash-git-prompt/gitprompt.sh
154+
fi
155+
156+
# Source ROS environment
157+
if [ -n "${ROS_DISTRO}" ]; then
158+
source /opt/ros/${ROS_DISTRO}/setup.bash
159+
export ROSCONSOLE_STDOUT_LINE_BUFFERED=1
160+
export ROSCONSOLE_FORMAT='${severity} ${time:%Y-%m-%d %H:%M:%S.%f} ${logger} - ${message}'
161+
# export RCUTILS_LOGGING_BUFFERED_STREAM=1
162+
# export RCUTILS_LOGGING_USE_STDOUT=1
163+
export RCUTILS_COLORIZED_OUTPUT=1
164+
case "${ROS_DISTRO}" in
165+
jazzy|rolling)
166+
export RCUTILS_CONSOLE_OUTPUT_FORMAT="{severity} {date_time_with_ms} {name} - {message}"
167+
;;
168+
*)
169+
export RCUTILS_CONSOLE_OUTPUT_FORMAT="{severity} {time} {name} - {message}"
170+
;;
171+
esac
172+
173+
fi

.devcontainer/.dummy-dir/.gitkeep

Whitespace-only changes.

.devcontainer/.dummy-file

Whitespace-only changes.

.devcontainer/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.bash_history.d
2+
/.vscode-server

.devcontainer/.vscode-server/.gitkeep

Whitespace-only changes.

.devcontainer/helper.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -eEu -o pipefail
3+
4+
command=$1
5+
shift
6+
7+
case ${command} in
8+
onCreateCommand)
9+
containerWorkspaceFolder=$1
10+
# ls -la ${containerWorkspaceFolder}
11+
# id
12+
case ${ROS_DISTRO} in
13+
noetic)
14+
if [ ! -d ${containerWorkspaceFolder}/ros1_ws ]; then
15+
${containerWorkspaceFolder}/create_ros_ws.sh -d ros1_ws
16+
fi
17+
;;
18+
humble|jazzy)
19+
if [ ! -d ${containerWorkspaceFolder}/ros2_ws ]; then
20+
${containerWorkspaceFolder}/create_ros_ws.sh -d ros2_ws
21+
fi
22+
;;
23+
*)
24+
echo "Don't know how to create a ROS workspace for ROS_DISTRO=${ROS_DISTRO}"
25+
exit 1
26+
;;
27+
esac
28+
;;
29+
*)
30+
echo "bad command: ${command}"
31+
exit 1
32+
;;
33+
esac
34+
35+
exit 0

.devcontainer/humble/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ghcr.io/fixposition/fixposition-sdk:humble-dev
2+
3+
# RUN <<EOF
4+
# # Install additional packages
5+
# set -e
6+
# export DEBIAN_FRONTEND=noninteractive
7+
# apt-get -y update
8+
# apt-get -y --with-new-pkgs upgrade
9+
# apt-get -y --no-install-recommends install some-package another-package ...
10+
# apt-get -y autoremove
11+
# apt-get clean
12+
# EOF
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// https://aka.ms/devcontainer.json
2+
{
3+
"name": "Fixposition ROS2 driver (Humble)",
4+
"build": { "dockerfile": "Dockerfile", "context": "../.." },
5+
"remoteUser": "fpsdk",
6+
"updateRemoteUserUID": true,
7+
"capAdd": ["SYS_PTRACE"],
8+
"mounts": [
9+
// Persistent bash history
10+
"source=${localWorkspaceFolder}/.devcontainer/.bashrc,target=/home/fpsdk/.bashrc,type=bind",
11+
"source=${localWorkspaceFolder}/.devcontainer/.bash_logout,target=/home/fpsdk/.bash_logout,type=bind",
12+
"source=${localWorkspaceFolder}/.devcontainer/.bash_history.d,target=/home/fpsdk/.bash_history.d,type=bind",
13+
// Persistent .vscode-server
14+
"source=${localWorkspaceFolder}/.devcontainer/.vscode-server,target=/home/fpsdk/.vscode-server,type=bind",
15+
// The code we're working on
16+
"source=${localWorkspaceFolder},target=/home/fpsdk/fixposition_driver,type=bind",
17+
],
18+
"workspaceFolder": "/home/fpsdk/fixposition_driver",
19+
"runArgs": [ "--name=fixposition_driver-humble-${localEnv:USER}", "--hostname=humble" ],
20+
"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/helper.sh onCreateCommand ${containerWorkspaceFolder}",
21+
"customizations": {
22+
"vscode": {
23+
"settings": {
24+
"files.exclude": {
25+
"**/.git": true,
26+
".vscode-cache": true,
27+
"**/*~": true,
28+
".vstags": true,
29+
"**/build/**": true,
30+
"core": true,
31+
"**/.devcontainer/.vscode-server/**": true,
32+
".devcontainer/.vscode-server/**": true,
33+
"**/.vscode-server/**": true
34+
},
35+
"search.exclude": {
36+
"tmp": true,
37+
"**/ros1_ws/**": true,
38+
"**/ros2_ws/**": true
39+
},
40+
"files.watcherExclude": {
41+
"**/.git/objects/**": true,
42+
"**/.git/refs/**": true,
43+
"**/.git/logs/**": true,
44+
"**/.git/subtree-cache/**": true,
45+
"**/.git/worktrees/**": true,
46+
"**/.vscode-*/**": true,
47+
"**/ros1_ws/**": true,
48+
"**/ros2_ws/**": true
49+
}
50+
}
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)