diff --git a/software/environment/rover/auto_poweroff/auto_poweroff.py b/software/environment/rover/auto_poweroff/auto_poweroff.py index 609ae19..3e1257a 100755 --- a/software/environment/rover/auto_poweroff/auto_poweroff.py +++ b/software/environment/rover/auto_poweroff/auto_poweroff.py @@ -4,23 +4,34 @@ ##################################### # Python native imports from time import time, sleep -from os.path import exists -from os import system +from os.path import exists, dirname, realpath +from os import system, chdir +import sys ##################################### # Global Variables ##################################### -UDEV_RULES_PATHS = ["../UDEV_rules/99-rover-usb-serial.rules", "../UDEV_rules/99-rover-cameras.rules"] +UDEV_RULES_PATHS = ["../UDEV_rules/99-rover-usb-serial.rules"] SHUTDOWN_TIMEOUT = 5 +##################################### +# get_script_path Definition +##################################### +def get_script_path(): + return dirname(realpath(sys.argv[0])) + + ##################################### # udev_parser Definition ##################################### def udev_parser(rules_paths): device_paths = {} + script_path = get_script_path() + chdir(script_path) + for current_file in rules_paths: lines = open(current_file).readlines() diff --git a/software/environment/rover/startup/screenrc b/software/environment/rover/startup/screenrc new file mode 100644 index 0000000..fba14dd --- /dev/null +++ b/software/environment/rover/startup/screenrc @@ -0,0 +1,86 @@ +# the following two lines give a two-line status, with the current window highlighted +hardstatus alwayslastline +hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]' + +# huge scrollback buffer +defscrollback 5000 + +# no welcome message +startup_message off + +# 256 colors +attrcolor b ".I" +termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' +defbce on + +# mouse tracking allows to switch region focus by clicking +mousetrack on + +# default windows +screen -t RoverMain 1 bash -c "/home/nvidia/Github/Rover_2017_2018/software/environment/rover/startup/startup.sh" +screen -t Shell 2 bash +select 1 +bind c screen 1 # window numbering starts at 1 not 0 +bind 0 select 10 + +# get rid of silly xoff stuff +bind s split + +# layouts +layout autosave on +layout new one +select 1 +layout new two +select 1 +split +resize -v +8 +focus down +select 4 +focus up +layout new three +select 1 +split +resize -v +7 +focus down +select 3 +split -v +resize -h +10 +focus right +select 4 +focus up + +layout attach one +layout select one + +# navigating regions with Ctrl-arrows +bindkey "^[[1;5D" focus left +bindkey "^[[1;5C" focus right +bindkey "^[[1;5A" focus up +bindkey "^[[1;5B" focus down + +# switch windows with F3 (prev) and F4 (next) +bindkey "^[OR" prev +bindkey "^[OS" next + +# switch layouts with Ctrl+F3 (prev layout) and Ctrl+F4 (next) +bindkey "^[O1;5R" layout prev +bindkey "^[O1;5S" layout next + +# F2 puts Screen into resize mode. Resize regions using hjkl keys. +bindkey "^[OQ" eval "command -c rsz" # enter resize mode + +# use hjkl keys to resize regions +bind -c rsz h eval "resize -h -5" "command -c rsz" +bind -c rsz j eval "resize -v -5" "command -c rsz" +bind -c rsz k eval "resize -v +5" "command -c rsz" +bind -c rsz l eval "resize -h +5" "command -c rsz" + +# quickly switch between regions using tab and arrows +bind -c rsz \t eval "focus" "command -c rsz" # Tab +bind -c rsz -k kl eval "focus left" "command -c rsz" # Left +bind -c rsz -k kr eval "focus right" "command -c rsz" # Right +bind -c rsz -k ku eval "focus up" "command -c rsz" # Up +bind -c rsz -k kd eval "focus down" "command -c rsz" # Down + +# Clean up screen display with files +altscreen on diff --git a/software/environment/rover/startup/startup.sh b/software/environment/rover/startup/startup.sh new file mode 100755 index 0000000..8b240c2 --- /dev/null +++ b/software/environment/rover/startup/startup.sh @@ -0,0 +1,6 @@ +#!/bin/bash +source /opt/ros/kinetic/setup.bash +source /home/nvidia/catkin_workspace/devel/setup.bash +/home/nvidia/Github/Rover_2017_2018/software/environment/rover/auto_poweroff/auto_poweroff.py & +roslaunch rover_main rover.launch +exec bash