mirror of
https://github.com/caperren/school_archives.git
synced 2025-11-09 13:41:13 +00:00
Added 2017-2018 mars rover repository.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# udevadm info -a -p $(udevadm info -q path -n /dev/video2)
|
||||
# ATTRS{serial}=="B9A8A5FF", MODE="0660",GROUP="nvidia",
|
||||
# SUBSYSTEM=="video4linux",ATTRS{idVendor}=="0x046d",ATTRS{idProduct}=="0x082d",NAME="videoext"
|
||||
|
||||
# The zed camera
|
||||
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="2b03", ATTRS{idProduct}=="f580", SYMLINK+="rover/camera_zed"
|
||||
|
||||
# The first C920 Webcam
|
||||
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="082d", ATTRS{serial}=="B9A8A5FF", SYMLINK+="rover/camera_undercarriage"
|
||||
|
||||
# The second C920 Webcam
|
||||
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="082d", ATTRS{serial}=="A98AA5FF", SYMLINK+="rover/camera_chassis"
|
||||
|
||||
# The special main nav cam
|
||||
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="05a3", ATTRS{idProduct}=="9422", ATTRS{serial}=="SN0001", ATTR{index}=="0", SYMLINK+="rover/camera_main_navigation"
|
||||
@@ -0,0 +1,34 @@
|
||||
# Examples
|
||||
#########################
|
||||
# SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="FTU9EU0I", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="rover/ttyDEV0"
|
||||
# SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="FTU9EU0I", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="rover/ttyDEV1"
|
||||
# SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="FTU9EU0I", ENV{ID_USB_INTERFACE_NUM}=="02", SYMLINK+="rover/ttyCompass"
|
||||
# SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="FTU9EU0I", ENV{ID_USB_INTERFACE_NUM}=="03", SYMLINK+="rover/ttyGPS"
|
||||
#########################
|
||||
|
||||
|
||||
##### NOTE!!!! The IONIs cannot be on IRIS. The throughput is too high for it to handle with only a 12Mbit usb hub onboard #####
|
||||
|
||||
# IRIS Board Mappings
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM2CZLZF", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="rover/ttyREAR"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM2CZLZF", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="rover/ttyLEFT"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM2CZLZF", ENV{ID_USB_INTERFACE_NUM}=="02", SYMLINK+="rover/ttyRIGHT"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM2CZLZF", ENV{ID_USB_INTERFACE_NUM}=="03", SYMLINK+="rover/ttyEffectors"
|
||||
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM2HPA6V", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="rover/ttyIRIS_1_0"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM2HPA6V", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="rover/ttyTowerAndPanTilt"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM2HPA6V", ENV{ID_USB_INTERFACE_NUM}=="02", SYMLINK+="rover/ttyOdometry"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM2HPA6V", ENV{ID_USB_INTERFACE_NUM}=="03", SYMLINK+="rover/ttyChassisPanTilt"
|
||||
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM34WE0R", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="rover/ttyRDF_SoilProbe"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM34WE0R", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="rover/ttyIRIS_2_1"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM34WE0R", ENV{ID_USB_INTERFACE_NUM}=="02", SYMLINK+="rover/ttyIRIS"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="NM34WE0R", ENV{ID_USB_INTERFACE_NUM}=="03", SYMLINK+="rover/ttyExtraUART"
|
||||
|
||||
# External 485 adapter for the ARM
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="AH05K2Y8", SYMLINK+="rover/ttyARM"
|
||||
|
||||
##### Mappings from OMSI / EXPO driving with individual adapters
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", ATTRS{serial}=="DA01OM1N", SYMLINK+="rover/ttyScale"
|
||||
# SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A906H89E", SYMLINK+="rover/ttyRIGHT"
|
||||
# SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A906H7P0", SYMLINK+="rover/ttyREAR"
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
sudo cp 99-rover-cameras.rules /etc/udev/rules.d/.
|
||||
sudo cp 99-rover-usb-serial.rules /etc/udev/rules.d/.
|
||||
sudo reboot
|
||||
@@ -0,0 +1,86 @@
|
||||
[LEFT_CAM_2K]
|
||||
cx = 1103.74
|
||||
cy = 663.956
|
||||
fx = 1389.02
|
||||
fy = 1389.02
|
||||
k1 = -0.175403
|
||||
k2 = 0.0278335
|
||||
|
||||
|
||||
[LEFT_CAM_FHD]
|
||||
cx = 959.74
|
||||
cy = 582.956
|
||||
fx = 1389.02
|
||||
fy = 1389.02
|
||||
k1 = -0.175403
|
||||
k2 = 0.0278335
|
||||
|
||||
|
||||
[LEFT_CAM_HD]
|
||||
cx = 638.37
|
||||
cy = 379.978
|
||||
fx = 694.512
|
||||
fy = 694.512
|
||||
k1 = -0.175403
|
||||
k2 = 0.0278335
|
||||
|
||||
|
||||
[LEFT_CAM_VGA]
|
||||
cx = 334.185
|
||||
cy = 196.989
|
||||
fx = 347.256
|
||||
fy = 347.256
|
||||
k1 = -0.175403
|
||||
k2 = 0.0278335
|
||||
|
||||
|
||||
[RIGHT_CAM_2K]
|
||||
cx = 1152.59
|
||||
cy = 667.942
|
||||
fx = 1393.95
|
||||
fy = 1393.95
|
||||
k1 = -0.175501
|
||||
k2 = 0.0279378
|
||||
|
||||
|
||||
[RIGHT_CAM_FHD]
|
||||
cx = 1008.59
|
||||
cy = 586.942
|
||||
fx = 1393.95
|
||||
fy = 1393.95
|
||||
k1 = -0.175501
|
||||
k2 = 0.0279378
|
||||
|
||||
|
||||
[RIGHT_CAM_HD]
|
||||
cx = 662.797
|
||||
cy = 381.971
|
||||
fx = 696.977
|
||||
fy = 696.977
|
||||
k1 = -0.175501
|
||||
k2 = 0.0279378
|
||||
|
||||
|
||||
[RIGHT_CAM_VGA]
|
||||
cx = 346.399
|
||||
cy = 197.985
|
||||
fx = 348.489
|
||||
fy = 348.489
|
||||
k1 = -0.175501
|
||||
k2 = 0.0279378
|
||||
|
||||
|
||||
[STEREO]
|
||||
BaseLine = 120.098
|
||||
CV_2K = 4.66838e-06
|
||||
CV_FHD = 4.66838e-06
|
||||
CV_HD = 4.66838e-06
|
||||
CV_VGA = 4.66838e-06
|
||||
RX_2K = 0.000518746
|
||||
RX_FHD = 0.000518746
|
||||
RX_HD = 0.000518746
|
||||
RX_VGA = 0.000518746
|
||||
RZ_2K = -0.00147751
|
||||
RZ_FHD = -0.00147751
|
||||
RZ_HD = -0.00147751
|
||||
RZ_VGA = -0.00147751
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env python
|
||||
#####################################
|
||||
# Imports
|
||||
#####################################
|
||||
# Python native imports
|
||||
from time import time, sleep
|
||||
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"]
|
||||
|
||||
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()
|
||||
|
||||
for line in lines:
|
||||
if line[0] != "#" and line[0] != "\n":
|
||||
current_path = line.split("SYMLINK+=")[1].strip("\"\n")
|
||||
device_paths["/dev/" + current_path] = time()
|
||||
|
||||
return device_paths
|
||||
|
||||
|
||||
#####################################
|
||||
# AutoPoweroffWatchdog Class Definition
|
||||
#####################################
|
||||
class AutoPoweroffWatchdog(object):
|
||||
def __init__(self, devices, shutdown_timeout, do_poweroff=True):
|
||||
self.watched_devices = devices
|
||||
self.shutdown_timeout = shutdown_timeout
|
||||
self.do_poweroff = do_poweroff
|
||||
|
||||
# ########## Thread Flags ##########
|
||||
self.run_thread_flag = True
|
||||
|
||||
self.run()
|
||||
|
||||
def run(self):
|
||||
while self.run_thread_flag:
|
||||
self.check_and_update_devices()
|
||||
self.initiate_shutdown_if_needed()
|
||||
sleep(0.25)
|
||||
|
||||
def check_and_update_devices(self):
|
||||
for device in self.watched_devices:
|
||||
if exists(device):
|
||||
self.watched_devices[device] = time()
|
||||
|
||||
def initiate_shutdown_if_needed(self):
|
||||
for device in self.watched_devices:
|
||||
if (time() - self.watched_devices[device]) < self.shutdown_timeout:
|
||||
return
|
||||
|
||||
if self.do_poweroff:
|
||||
system("sudo wall -n No devices seen for %s seconds. Powering down. Poweroff script exiting." %
|
||||
self.shutdown_timeout)
|
||||
system("sudo poweroff")
|
||||
exit()
|
||||
else:
|
||||
system("sudo wall -n No devices seen for %s seconds, but not powering down. Poweroff script exiting.")
|
||||
exit()
|
||||
|
||||
|
||||
#####################################
|
||||
# Main
|
||||
#####################################
|
||||
if __name__ == "__main__":
|
||||
watched_devices = udev_parser(UDEV_RULES_PATHS)
|
||||
AutoPoweroffWatchdog(watched_devices, SHUTDOWN_TIMEOUT, True)
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user