-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes for new Location Tracking #64
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
5784ce4
Bash changes for new Location Tracking
cwosw 0ec9c3c
Added camera locations into config file and modified the calibration …
cwosw 3a8f726
Added new changes to allow for AprilTags to be run in standard Linux …
cwosw 8fa0000
Added version stuffs
cwosw d5552fe
version change
cwosw 85fa1f2
current changes
cwosw 3cd5b58
current changes
cwosw 6cd32cf
fixed a small var issue
cwosw 8b468a8
Implemented cuda code for the locations tracking
cwosw c6726c4
offsets were already implemented
cwosw e98a802
Changed variable to use the actual flag name
cwosw c2fecf4
fixed things
cwosw 4d044ea
added offset files
cwosw 054933a
completed the merge
cwosw 86cca1a
Merge pull request #65 from Team766/betterAprilTagsFileLocations
cwosw 770c585
fixes
cwosw 0f226ba
more fixes
cwosw 96cec11
bad fixes, but its fine
cwosw 41de844
if it works, it works
cwosw fb11567
Fixed libAprilTags killHandler and made it work
cwosw 9f28df7
Merge pull request #66 from Team766/crystal.fixedKillHandler
cwosw 4b9bdb6
Fixed camlocations and reconfigured files
cwosw b71f757
Merge branch 'betterLocations' of https://github.com/Team766/apriltag…
cwosw 418f563
fixed tag size and corrected seasocks being broken
cwosw 68cb242
todo: make the macro work
cwosw a7a1ef3
fixed the macro
cwosw 63f8671
Code touchups
cwosw 3708f4f
added recalibrated files for cams with serials 199 and UC762W
cwosw 47d2e33
recalibrated the cameras
cwosw 5bc4a8f
fixed problematic calibration files
cwosw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,13 @@ if [ $# -ne 1 ]; then | |
exit 1 | ||
fi | ||
|
||
if [ ! -f '/apps/AprilTags/Backend/ws_server' ]; then | ||
if [ ! -f '/opt/AprilTags/Backend/ws_server' ]; then | ||
echo "missing backend" | ||
exit 2 | ||
fi | ||
|
||
function killIfRunning() { | ||
PID=`libAprilTags.sh pid $1` | ||
PID=`libAprilTags pid $1` | ||
if [ $PID -ne 0 ]; then | ||
kill -2 $PID | ||
return 1 | ||
|
@@ -20,23 +20,20 @@ function killIfRunning() { | |
} | ||
|
||
# set clocks to max frequency (jetson only) | ||
jetson_clocks || true | ||
jetson_clocks || true 1>&2 >> /dev/null | ||
|
||
#open source for args | ||
source /apps/AprilTags/args | ||
|
||
# make sure that the bin dir is actually loaded | ||
PATH="$PATH:/apps/bin" | ||
source /opt/AprilTags/args | ||
|
||
if [[ $1 == "start" ]]; then | ||
# check for lock | ||
if [ -f "/apps/AprilTags/servicerunning" ]; then | ||
if [ -f "/opt/AprilTags/servicerunning" ]; then | ||
echo "service is already running" | ||
echo "HINT: if you think the service is not running, then run 'AprilTags.sh --validate lockfile'" | ||
echo "HINT: if you think the service is not running, then run 'AprilTags --validate lockfile'" | ||
# now check if it is allowed to remove the lockfile.. | ||
if [[ $autormlockfile == "true" ]]; then | ||
# check for if the services are fine | ||
status=$(/apps/bin/AprilTags.sh -V lockfile) | ||
status=$(AprilTags -V lockfile) | ||
lockfilestatus=$(echo $status | awk -F ";" '{print $1}' | awk -F "=" '{print $2}') | ||
if [[ $lockfilestatus == "false" ]]; then | ||
# the lockfile is gone, and nothing is wrong | ||
|
@@ -52,62 +49,70 @@ if [[ $1 == "start" ]]; then | |
fi | ||
fi | ||
|
||
# to fix some odd pathing things | ||
cd /apps/AprilTags | ||
|
||
touch /apps/AprilTags/servicerunning | ||
touch /opt/AprilTags/servicerunning | ||
|
||
cams=`libAprilTags.sh camIDs` | ||
cams=`libAprilTags camIDs` | ||
if [[ $? -ne 0 ]]; then | ||
echo "No cameras found or something. Try plugging some in, or else the cameras are not being seen." | ||
exit 5 | ||
fi | ||
|
||
# cd again just to be safe (that lib WILL cd) | ||
cd /apps/AprilTags | ||
cd /opt/AprilTags # seasocks depends on this | ||
|
||
# iterate | ||
for cam in $cams; do | ||
# set items off of the output cam | ||
IFS=: read -r camID camIndex <<< "$cam" | ||
|
||
# not yet | ||
|
||
# get the offset file | ||
#camLoc=$(libAprilTags.sh getCamLoc $camID) | ||
#if [[ $? -ne 0 ]]; then | ||
# echo "FAILED TO FIND CAMERA OFFSET ${camID}, EXITING..." | ||
# exit 6 | ||
#fi | ||
camLoc=$(libAprilTags getCamLoc $camID) | ||
if [[ $? -ne 0 ]]; then | ||
echo "FAILED TO FIND CAMERA OFFSET ${camID}, EXITING..." | ||
exit 6 | ||
fi | ||
|
||
camFilePlace="/opt/AprilTags/data/camlocs/cam-${camLoc}-offset.json" | ||
if ! [[ -f $camFilePlace ]]; then | ||
echo "FAILED TO FIND CAMERA OFFSET FILE FOR CAM ${camID} with location ${camLoc} (file missing ${camFilePlace}" | ||
exit 6 | ||
fi | ||
|
||
# ensure that the calibration file exists | ||
if ! [[ -f /apps/AprilTags/data/calibration/calibrationmatrix_${camID}.json ]]; then | ||
if ! [[ -f /opt/AprilTags/data/calibration/calibrationmatrix_${camID}.json ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice error checking here, with clear, understandable error messages! Great job! |
||
echo "FAILED TO FIND CAMERA CALIBRATION FILE ${camID}, EXITING..." | ||
exit 6 | ||
fi | ||
|
||
# set camName | ||
if [[ ${camLoc} == "TEMPLATE" ]]; then | ||
camName="cam${camID}" | ||
else | ||
camName="${camLoc}" | ||
fi | ||
|
||
# set args | ||
args=`$backend` # this actually is magical because of the weird eval thing | ||
# https://stackoverflow.com/questions/5112663/bash-variable-reevaluation | ||
|
||
# abs path BECAUSE of the proc getting commands | ||
/apps/AprilTags/Backend/ws_server $args & | ||
echo $! >> /apps/AprilTags/servicerunning # add every pid to a new line | ||
/opt/AprilTags/Backend/ws_server $args & | ||
echo $! >> /opt/AprilTags/servicerunning # add every pid to a new line | ||
done | ||
|
||
exit | ||
|
||
elif [[ $1 == "stop" ]]; then | ||
if [[ -f /apps/AprilTags/servicerunning ]]; then | ||
if [[ -f /opt/AprilTags/servicerunning ]]; then | ||
# read the file, kill if a pid is found inside | ||
while read p; do | ||
if [[ "$p" =~ ^-?[0-9]+$ ]]; then # regex to find int | ||
# assume its a PID that belongs to ws_server if running | ||
if ps -p $p > /dev/null | ||
then | ||
timeout -s INT 5s 'killHandler.sh ${p}' & | ||
timeout -s INT 5s 'libAprilTags killHandler ${p}' & | ||
fi | ||
fi | ||
done < /apps/AprilTags/servicerunning | ||
done < /opt/AprilTags/servicerunning | ||
fi | ||
# and add the rest of it | ||
# this is broken, and I am too lazy to fix it | ||
|
@@ -116,7 +121,7 @@ elif [[ $1 == "stop" ]]; then | |
# continue # just run the initial condition, a backup if the service orphaned something | ||
#done | ||
|
||
rm /apps/AprilTags/servicerunning | ||
rm /opt/AprilTags/servicerunning | ||
else | ||
echo "input ${1} not understood" | ||
exit 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Please be careful editing this file! | ||
# It looks odd and it is structured in two seperate ways, but it is fine, write inside the echo for backend | ||
# ${camIndex} is the video index of the camera, ${camID} is the id of the camera (by serial), and ${camLoc} is the location of the camera on the robot (as in tr for example to be top right) | ||
backend='eval echo "-camera_idx ${camIndex} -cal_file /apps/AprilTags/data/calibration/calibrationmatrix_${camID}.json -camera_name cam${camID}"' | ||
# ${camIndex} is the video index of the camera, ${camID} is the id of the camera (by serial), and ${camLoc} is the location of the camera on the robot (as in tr for example to be top right), ${camName} is the name of the camera | ||
backend='eval echo "-camera_idx ${camIndex} -cal_file /opt/AprilTags/data/calibration/calibrationmatrix_${camID}.json -position_file ${camFilePlace} -camera_name ${camName}"' | ||
# manager | ||
autormlockfile="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The weird Bash redirection things basically boil down to "Take the errors, put them into standard error, then throw the entire thing into /dev/null."