diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 46605adb0..046d28aa5 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -43,31 +43,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y -o Dpkg::Option vim \ rsync \ dialog \ - fish \ fuse -# VS Code -RUN curl -L -o /tmp/vscode.deb \ - 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64' && \ - apt-get install -y /tmp/vscode.deb && \ - rm -f /tmp/vscode.deb - -RUN su memristor -c 'code --install-extension eamodio.gitlens' && \ - su memristor -c 'code --install-extension ms-python.python' && \ - su memristor -c 'code --install-extension ms-vscode.cpptools-extension-pack' && \ - su memristor -c 'code --install-extension usernamehw.errorlens' && \ - su memristor -c 'code --install-extension redhat.vscode-xml' && \ - su memristor -c 'code --install-extension ms-iot.vscode-ros' - -# VS Code server, pinning version 4.22.0 as later versions seem to have broken the installation of cpp and ros extensions -RUN su memristor -c 'curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.22.0 ' && \ - su memristor -c 'code-server --install-extension eamodio.gitlens' && \ - su memristor -c 'code-server --install-extension ms-python.python' && \ - su memristor -c 'code-server --install-extension ms-vscode.cpptools-extension-pack' && \ - su memristor -c 'code-server --install-extension usernamehw.errorlens' && \ - su memristor -c 'code-server --install-extension redhat.vscode-xml' && \ - su memristor -c 'code-server --install-extension ms-iot.vscode-ros' - # Webots RUN curl -L -o /tmp/webots.deb \ 'https://github.com/cyberbotics/webots/releases/download/R2023b/webots_2023b_amd64.deb' && \ @@ -95,10 +72,6 @@ RUN wget -O /tmp/hotfix.deb http://snapshots.ros.org/humble/2024-08-28/ubuntu/po # User config COPY ./config/bashrc /tmp/bashrc -COPY ./config/fish/. /memristor/.config/fish/ -COPY ./config/starship.toml /memristor/.config/starship.toml -COPY ./config/vscode-server/config.yaml /memristor/.config/code-server/config.yaml -COPY ./config/vscode/. /memristor/ros2_ws/.vscode/ COPY ./config/Cyberobotics/. /memristor/.config/Cyberbotics/ COPY --chmod=755 ./config/setup.sh /usr/bin/ diff --git a/docker/config/fish/config.fish b/docker/config/fish/config.fish deleted file mode 100644 index d1c17376b..000000000 --- a/docker/config/fish/config.fish +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env fish - -set -x fish_greeting '' diff --git a/docker/config/fish/git.fish b/docker/config/fish/git.fish deleted file mode 100644 index a1924b24c..000000000 --- a/docker/config/fish/git.fish +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env fish - -if status --is-interactive - set -g fish_user_abbreviations - # Git shortcuts - abbr --add gs 'git status' - abbr --add gsh 'git show' - abbr --add ga 'git add' - abbr --add gc 'git commit -m' - abbr --add gca 'git commit --amend' - abbr --add gl 'git log' - abbr --add gp 'git push' - abbr --add gpf 'git push --force' - abbr --add gw 'git whatchanged' - abbr --add gm 'git merge' - abbr --add gpl 'git pull' - abbr --add gplr 'git pull --rebase' - abbr --add gco 'git checkout' - abbr --add gb 'git branch' - abbr --add gsw 'git switch' - abbr --add gr 'git restore' - abbr --add grb 'git rebase --interactive --committer-date-is-author-date' -end diff --git a/docker/config/fish/shortcuts.fish b/docker/config/fish/shortcuts.fish deleted file mode 100755 index fb856d0f9..000000000 --- a/docker/config/fish/shortcuts.fish +++ /dev/null @@ -1,291 +0,0 @@ -#!/usr/bin/env fish - -function set_or_keep -a name value; - if eval "test -z \$$name"; - set -g "$name" "$value" - end -end - -function set_or_fallback -a name value fallback; - if test -z "$value"; - set -g "$name" "$fallback" - else - set -g "$name" "$value" - end -end - -function detect_ros_ws_in_path; - set -g pwd_ws ( - pwd | awk -F '/' ' - BEGIN { - ws=1; - } - /_ws/ { - for (i = 1; i <= NF; i++) { - if ($i ~ /_ws$/) { - ws=i; - break; - } - } - } - END { - for (i = 2; i <= ws; i++) { - printf "/%s", $i; - } - } - ' - ) - set_or_fallback default_ws "$pwd_ws" "$HOME/ros2_ws" -end - -## Print shortcut manual -function shortcut_help; - detect_ros_ws_in_path - set_or_fallback dir "$COLCON_PREFIX_PATH" "$default_ws/install" - set dir "$dir/.." - mkdir -p "$dir" - awk ' - /^## / { - sub(/^## +/,"",$0); - print "\n\033[1m\033[34m" $0 "\033[0m"; - } - /^# / { - sub(/^# +/,"",$0); - gsub("\\[","\033[33m[",$0); - gsub("\\]","]\033[0m",$0); - print $0; - } - /^alias/ && !/="shortcut/ { - cmd=$0 - sub(/^.*="/,"",cmd); - sub(/"$/,"",cmd); - print "\033[35m" "Command: " "\033[0m" cmd "\033[0m"; - } - /^alias / { - sub(/=.+$/,"",$2); - print "\033[32m" "Shortcut: " "\033[0m\033[1m" $2 "\033[0m"; - } - /^abbr/ && !/="shortcut/ { - cmd="" - for (i=4;i<=NF;i++) {cmd=cmd " " $i} - sub(/^ "/,"",cmd); - sub(/"$/,"",cmd); - print "\033[35m" "Command: " "\033[0m" cmd "\033[0m"; - } - /^abbr / { - print "\033[32m" "Shortcut: " "\033[0m\033[1m" $3 "\033[0m"; - } - /^ *eval/ { - sub(/^ *eval "/,"",$0); - sub(/"$/,"",$0); - gsub("\\${","\033[36m${",$0); - gsub("\\}","}\033[0m",$0); - print "\033[35m" "Command: " "\033[0m" $0 "\033[0m"; - } - ' "$dir/src/mep3/docker/config/fish/shortcuts.fish" -end -alias h="shortcut_help" - -## Find TODO tasks in source files -# Arguments: -# - name [optional] -function shortcut_find_todo_tasks -a name; - detect_ros_ws_in_path - set_or_fallback dir "$workdir" "$default_ws" - mkdir -p "$dir" - if test -z "$name"; - grep -IHnri --exclude=shortcuts.fish "TODO" "$dir/src/mep3/" - else - grep -IHnri --exclude=shortcuts.fish "TODO.*(.*$name.*)" "$dir/src/mep3/" - end -end -alias todo="shortcut_find_todo_tasks" - -## Build current directory using colcon -# Arguments: -# - working directory [optional] -function shortcut_colcon_workspace_build -a workdir; - detect_ros_ws_in_path - set_or_fallback dir "$workdir" "$default_ws" - mkdir -p "$dir" - eval "cd $dir && colcon build --symlink-install" -end -alias cb="shortcut_colcon_workspace_build" - -## Remove existing build files -# Arguments: -# - workspace directory [optional] -function shortcut_remove_ros_workspace_build -a workspace; - detect_ros_ws_in_path - set_or_fallback default "$COLCON_PREFIX_PATH" "$default_ws/install" - set -g default "$default/.." - set_or_fallback dir "$workspace" "$default" - mkdir -p "$dir" - eval "rm -rf $dir/build/ $dir/install/" -end -alias rr="shortcut_remove_ros_workspace_build" - -## Source current ROS2 workspace -# Arguments: -# - workspace directory [optional] -function shortcut_source_ros_workspace -a workspace; - detect_ros_ws_in_path - set_or_fallback default "$COLCON_PREFIX_PATH" "$default_ws/install" - set -g default "$default/.." - set_or_fallback dir "$workspace" "$default" - mkdir -p "$dir" - if test -f "$dir/install/local_setup.bash"; - exec bash -c "source $dir/install/local_setup.bash; exec bash" - else - echo 'Workspace setup file is missing! Build it first.' 1>&2 - end -end -alias s="shortcut_source_ros_workspace" - -## Launch mep3_simulation -abbr --add sim "ros2 launch mep3_simulation simulation_launch.py" - -## Launch mep3_bringup -# Keyword arguments: -# - bt [bool] -# - strategy [file name without extension] -abbr --add br "ros2 launch mep3_bringup simulation_launch.py" - -## Launch Rviz for mep3_bringup -abbr --add rv "ros2 launch mep3_bringup rviz_launch.py" - -## Open Webots world -# Arguments: -# - workspace directory [optional] -# - world filename -function shortcut_webots_open_world -a one two; - detect_ros_ws_in_path - set_or_fallback default "$COLCON_PREFIX_PATH" "$default_ws/install" - set -g default "$default/.." - if [ -z "$one" ]; - set dir "$default" - set file "eurobot.wbt" - else if echo "$one" | grep '.wbt$'; - set dir "$default" - set file "$one" - else - set dir "$two" - set_or_fallback file "$two" "eurobot.wbt" - end - mkdir -p "$dir" - eval "webots $dir/src/mep3/mep3_simulation/webots_data/worlds/$file" -end -alias we="shortcut_webots_open_world" - -## Launch Teleop Twist Keyboard -# Arguments: -# - namespace [optional] -function shortcut_teleop_twist_keyboard -a namespace; - if echo "$2" | grep -qv '^[0-9\.-]*$'; - set_or_fallback namespace "$namespace" "$big" - shift - else - set namespace 'big' - end - eval "ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r cmd_vel:=$namespace/cmd_vel" -end -alias te="shortcut_teleop_twist_keyboard" - - -## Launch NavigateToPose action -# Arguments: -# - namespace -# - position x [m] -# - position y [m] -# - angle theta [deg] -function shortcut_action_navigate_to_pose -a namespace x y theta; - set theta (math "$theta * pi / 180.0") - set z (math "sin($theta / 2)") - set w (math "cos($theta / 2)") - set position (printf '{x: %.3f, y: %.3f, z: 0}' $x $y) - set orientation (printf '{x: 0, y: 0, z: %.5f, w: %.5f}' $z $w) - set message " { - pose: { - header: {frame_id: 'map'}, - pose: { - position: $position, - orientation: $orientation - } - } - }" - eval "ros2 action send_goal /$namespace/navigate_to_pose nav2_msgs/action/NavigateToPose '$message'" -end -alias np="shortcut_action_navigate_to_pose" - -## Launch ScoreboardTaskAction action -# Arguments: -# - task -# - points -function shortcut_scoreboard_task -a task points; - set message " { - task: $task, - points: $points - }" - eval "ros2 topic pub --once /scoreboard mep3_msgs/msg/Scoreboard '$message'" -end -alias sc="shortcut_scoreboard_task" - -## Launch VacuumPumpCommand action -# Arguments: -# - namespace -# - pump_name -# - connect [bool] -function shortcut_action_vacuum_pump -a namespace pump_name connect; - set message " { - connect: $connect - }" - eval "ros2 action send_goal /$namespace/vacuum_pump_command/$pump_name mep3_msgs/action/VacuumPumpCommand '$message'" -end -alias vc="shortcut_action_vacuum_pump" - -## Launch MotionCommand action -# Arguments: -# - namespace -# - command [f|r|a] -# - value [m|deg] -# - velocity [m/s|rad/s] [optional] -# - acceleration [m/s²|rad/s²] [optional] -function shortcut_action_motion -a namespace cmd val vel accel; - set_or_fallback value "$val" '0' - set_or_fallback velocity "$vel" '0' - set_or_fallback acceleration "$accel" '0' - switch $cmd - case 'f' - set command 'forward' - set velocity_linear "$velocity" - set acceleration_linear "$acceleration" - set velocity_angular 0 - set acceleration_angular 0 - case 'r' - set command 'rotate_relative' - set value (math "$value * pi / 180.0") - set velocity_angular "$velocity" - set acceleration_angular "$acceleration" - set velocity_linear 0 - set acceleration_linear 0 - case 'a' - set command 'rotate_absolute' - set value (math "$value * pi / 180.0") - set velocity_angular "$velocity" - set acceleration_angular "$acceleration" - set velocity_linear 0 - set acceleration_linear 0 - case '*' - return 1 - end - set message " { - command: $command, - value: $value, - velocity_linear: $velocity_linear, - acceleration_linear: $acceleration_linear, - velocity_angular: $velocity_angular, - acceleration_angular: $acceleration_angular - }" - eval "ros2 action send_goal /$namespace/motion_command mep3_msgs/action/MotionCommand '$message'" -end -alias mo="shortcut_action_motion" diff --git a/docker/config/setup.sh b/docker/config/setup.sh index 9ee4f95da..fbe0350a9 100755 --- a/docker/config/setup.sh +++ b/docker/config/setup.sh @@ -3,20 +3,16 @@ _configure_proxy=false _vnc=false _first_time_ros_setup=false -_enhanced_shell_prompt=false -_shell_shortcuts=false _interactive=false usage() { - echo "Usage: $0 [--help] [--configure-proxy] [--vnc] [--first-time-ros-setup] [--enhanced-shell-prompt] [--shell-shortcuts] [--interactive]" + echo "Usage: $0 [--help] [--configure-proxy] [--vnc] [--first-time-ros-setup] [--interactive]" echo "--help print help and exit" echo "--interactive do everything interactively" echo "--no-default do not use default setup configurations" - echo "--configure-proxy configures proxy for use in ftn network" + echo "--configure-proxy configures proxy for use in FTN network" echo "--vnc configures VNC server in the container for outside remote DE use" - echo "--first-time-ros-setup configures ros for the first time setup" - echo "--enhanced-shell-prompt enables starship enhanced shell prompt" - echo "--shell-shortcuts enables shell shortcuts for easier tools use" + echo "--first-time-ros-setup configures ROS for the first time setup" exit } @@ -27,7 +23,6 @@ default_configure_proxy() { configure_proxy() { if $_interactive; then - # FTN proxy is actually enabled here if dialog --title 'mep3 config' --defaultno --yesno 'Enable UNS proxy' 5 30; then sed '/# Setup_proxy/d' -i /memristor/.bashrc sudo sed '/# Setup_proxy/d' -i /etc/apt/apt.conf @@ -58,42 +53,6 @@ first_time_ros_setup() { default_first_time_ros_setup } -default_enhanced_shell_prompt() { - sed '/# Setup_prompt/d' -i /memristor/.config/fish/config.fish - echo 'starship init fish | source # Setup_prompt' >>/memristor/.config/fish/config.fish - eval "curl -sS https://starship.rs/install.sh | sh -s -- --yes" -} - -enhanced_shell_prompt() { - if $_interactive; then - if dialog --title 'mep3 config' --yesno 'Enable enhanced shell prompt' 5 38; then - default_enhanced_shell_prompt - return - else - sed '/# Setup_prompt/d' -i /memristor/.config/fish/config.fish - fi - fi - default_enhanced_shell_prompt -} - -default_shell_shortcuts() { - sed '/# Setup_shortcuts/d' -i /memristor/.config/fish/config.fish - echo "source /memristor/ros2_ws/src/mep3/docker/config/fish/shortcuts.fish &>/dev/null # Setup_shortcuts" >>/memristor/.config/fish/config.fish - echo "source /memristor/ros2_ws/src/mep3/docker/config/fish/git.fish &>/dev/null # Setup_shortcuts" >>/memristor/.config/fish/config.fish -} - -shell_shortcuts() { - if $_interactive; then - if dialog --title 'mep3 config' --yesno 'Enable shell shortcuts' 5 30; then - default_shell_shortcuts - return - else - sed '/# Setup_shortcuts/d' -i /memristor/.config/fish/config.fish - fi - fi - default_shell_shortcuts -} - interactive_vnc() { if dialog --title 'mep3 config' --yesno 'Enable VNC' 5 30; then VNC_CMD='/usr/bin/vnc.sh &>/dev/null' @@ -135,12 +94,6 @@ vnc() { default_vnc } -finalize() { - sed '/# Setup_shell/d' -i /memristor/.bashrc - echo 'echo "$-" | grep i -q && exec fish # Setup_shell' >>/memristor/.bashrc - clear -} - while [ "$#" -gt 0 ]; do case "$1" in --configure-proxy) @@ -152,19 +105,9 @@ while [ "$#" -gt 0 ]; do --first-time-ros-setup) _first_time_ros_setup=true ;; - --enhanced-shell-prompt) - _enhanced_shell_prompt=true - ;; - --shell-shortcuts) - _shell_shortcuts=true - ;; --interactive) _interactive=true ;; - --default) - _enhanced_shell_prompt=true - _shell_shortcuts=true - ;; --help|*) usage ;; @@ -175,8 +118,6 @@ done if $_interactive; then configure_proxy first_time_ros_setup - enhanced_shell_prompt - shell_shortcuts vnc else if $_configure_proxy; then @@ -185,15 +126,7 @@ else if $_first_time_ros_setup; then first_time_ros_setup fi - if $_enhanced_shell_prompt; then - enhanced_shell_prompt - fi - if $_shell_shortcuts; then - shell_shortcuts - fi if $_vnc; then vnc fi fi - -finalize diff --git a/docker/config/starship.toml b/docker/config/starship.toml deleted file mode 100644 index 2f7a1d0cf..000000000 --- a/docker/config/starship.toml +++ /dev/null @@ -1,19 +0,0 @@ -[container] -disabled = true - -[git_status] -conflicted = "c" -ahead = "A" -behind = "B" -diverged = "D" -up_to_date = "" -untracked = "u" -stashed = "" -modified = "m" -staged = "s" -renamed = "r" -deleted = "d" - -[status] -format = "[$status]($style)" -disabled = false diff --git a/docker/config/vscode-server/config.yaml b/docker/config/vscode-server/config.yaml deleted file mode 100644 index f422467e1..000000000 --- a/docker/config/vscode-server/config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -bind-addr: 0.0.0.0:31415 -auth: none -cert: false diff --git a/docker/config/vscode/c_cpp_properties.json b/docker/config/vscode/c_cpp_properties.json deleted file mode 100644 index 66fb7920c..000000000 --- a/docker/config/vscode/c_cpp_properties.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "configurations": [ - { - "browse": { - "databaseFilename": "", - "limitSymbolsToIncludedHeaders": true - }, - "includePath": [ - "${workspaceFolder}/**", - "/opt/ros/humble/include/", - "/usr/include/**" - ], - "name": "mep3", - "compilerPath": "/usr/bin/gcc", - "intelliSenseMode": "linux-gcc-x64", - "cStandard": "c17", - "cppStandard": "c++20" - } - ], - "version": 4 -}