testing-framework / R / Bestimmung_Umformungen_Rotm / Bestimmung_Drehrichtungen.r~ @ 8526ae8c
History | View | Annotate | Download (2.357 KB)
| 1 |
#!/usr/bin/env Rscript |
|---|---|
| 2 |
|
| 3 |
#Argumente einlesen |
| 4 |
args <- commandArgs(TRUE) |
| 5 |
if(length(args) == 2){
|
| 6 |
cat("dateiname=\"",args[1],"\"\n",sep="")
|
| 7 |
dateiname <- args[1] |
| 8 |
cat("vergleichsdatei=\"",args[2],"\"\n",sep="")
|
| 9 |
vergleichsdatei <- args[2] |
| 10 |
}else |
| 11 |
{
|
| 12 |
cat("Fehler: Bitte zwei Dateinamen angeben!","\n")
|
| 13 |
quit() |
| 14 |
} |
| 15 |
|
| 16 |
#Einlesen |
| 17 |
cat("Lese ","/home/jonas/Bachelorarbeit/bart2/",dateiname,"\n",sep="")
|
| 18 |
bart <- read.csv(file=paste("/home/jonas/Bachelorarbeit/bart2/",dateiname,sep=""),header=F)
|
| 19 |
cat("Lese ","/home/jonas/Dokumente/Studium/Bachelorarbeit/alvar/2.0.0/alvar-2.0.0-sdk-linux64-gcc44/build/build_gcc44_release/sample/",dateiname,"\n",sep="")
|
| 20 |
alvar <- read.csv(file=paste("/home/jonas/Dokumente/Studium/Bachelorarbeit/alvar/2.0.0/alvar-2.0.0-sdk-linux64-gcc44/build/build_gcc44_release/sample/",dateiname,sep=""),header=F)
|
| 21 |
cat("Lese ","/home/jonas/Dokumente/Studium/Bachelorarbeit/aruco/aruco-1.2.5/",dateiname,"\n",sep="")
|
| 22 |
aruco <- read.csv(file=paste("/home/jonas/Dokumente/Studium/Bachelorarbeit/aruco/aruco-1.2.5/",dateiname,sep=""),header=F)
|
| 23 |
cat("Lese ","/home/jonas/Dokumente/Studium/Bachelorarbeit/aruco/aruco-1.2.5/",dateiname,"\n",sep="")
|
| 24 |
aruco <- read.csv(file=paste("/home/jonas/Dokumente/Studium/Bachelorarbeit/aruco/aruco-1.2.5/",dateiname,sep=""),header=F)
|
| 25 |
cat("Lese ","/home/jonas/Dokumente/Studium/Bachelorarbeit/blender-files/Positions/",vergleichsdatei, sep="")
|
| 26 |
blender <- read.csv(file=paste("/home/jonas/Dokumente/Studium/Bachelorarbeit/blender-files/Positions/",vergleichsdatei, sep=""),header=F)
|
| 27 |
#Doppelte Zeilen mit identischen Daten entfernen |
| 28 |
bart <- unique(bart) |
| 29 |
alvar <- unique(alvar) |
| 30 |
aruco <- unique(aruco) |
| 31 |
|
| 32 |
#Ermittelt die aktuell von fit.r benutzte Rotationsmatrix und gibt sie aus |
| 33 |
printRotm <- function(liste,pfadInvMat){
|
| 34 |
init_mat_table <- read.table(file=pfadInvMat) |
| 35 |
init_rotm_inv <- matrix(unlist(init_mat_table), ncol=3, nrow=3, byrow=TRUE) |
| 36 |
matA <- matrix(unlist(liste[3,3:11]),ncol=3,byrow=TRUE) |
| 37 |
matB <- matA %*% init_rotm_inv |
| 38 |
print(matB) |
| 39 |
matA <- matrix(unlist(liste[103,3:11]),ncol=3,byrow=TRUE) |
| 40 |
matB <- matA %*% init_rotm_inv |
| 41 |
print(matB) |
| 42 |
} |
| 43 |
|
| 44 |
cat("BART","\n")
|
| 45 |
printRotm(bart,"bart_init_rotm_inv.table") |
| 46 |
cat("ALVAR","\n")
|
| 47 |
printRotm(alvar,"alvar_init_rotm_inv.table") |
| 48 |
#Zeilen vertauschen |
| 49 |
aruco[3,3:8] <- aruco[3,c(6:8,3:5)] |
| 50 |
aruco[103,3:8] <- aruco[103,c(6:8,3:5)] |
| 51 |
cat("ARUCO","\n")
|
| 52 |
printRotm(aruco,"aruco_init_rotm_inv.table") |
| 53 |
cat("BLENDER","\n")
|
| 54 |
printRotm(aruco,"blender_init_rotm_inv.table") |
| 55 |
|