### Vitaly Portnoy HP-Indigo
## Script to analyse JOTE
library(data.table)
library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
path<-"G:/MY Drive/JOTE/Avihai Test/"
ls<-list.files(path)
print(ls)
## [1] "500 Image 720x520 Zero Offset.csv"            
## [2] "500 Image 720x520 Zero Offset_after_ready.csv"
## [3] "500 Image 720x520.csv"                        
## [4] "Full Image 720x520.csv"                       
## [5] "Full_Logs_EILAT-MR391_2018-12-05T10-39-44.zip"
data1<-fread(paste0(path,ls[1]),skip=9,header = FALSE)
data1<-data1[,c(1,2,4,6,8,10,12,14,16,18)]
names(data1)<-c(
  "time",
  "front_trq",
  "rear_trq",
  "angle",
  "set_pos_front",
  "pos_front",
  "set_speed_front",
  "set_pos_rear",
  "pos_rear",
  "set_speed_rear")

data2<-fread(paste0(path,ls[2]),skip=9,header = FALSE)
data2<-data2[,c(1,2,4,6,8,10,12,14,16,18)]
names(data2)<-c(
  "time",
  "front_trq",
  "rear_trq",
  "angle",
  "set_pos_front",
  "pos_front",
  "set_speed_front",
  "set_pos_rear",
  "pos_rear",
  "set_speed_rear")
data3<-fread(paste0(path,ls[3]),skip=9,header = FALSE)
data3<-data3[,c(1,2,4,6,8,10,12,14,16,18)]
names(data3)<-c(
  "time",
  "front_trq",
  "rear_trq",
  "angle",
  "set_pos_front",
  "pos_front",
  "set_speed_front",
  "set_pos_rear",
  "pos_rear",
  "set_speed_rear")
data4<-fread(paste0(path,ls[4]),skip=9,header = FALSE)
data4<-data4[,c(1,2,4,6,8,10,12,14,16,18)]
names(data4)<-c(
  "time",
  "front_trq",
  "rear_trq",
  "angle",
  "set_pos_front",
  "pos_front",
  "set_speed_front",
  "set_pos_rear",
  "pos_rear",
  "set_speed_rear")


plot_ly(x=data1$angle/1000,y=data1$pos_front/1000, mode = 'lines')%>%
  layout(title = ls[1],
  xaxis = list(title = 'Angle'),
  yaxis = list(title = 'Position'))
## No trace type specified:
##   Based on info supplied, a 'scatter' trace seems appropriate.
##   Read more about this trace type -> https://plot.ly/r/reference/#scatter
plot_ly(x=data3$angle/1000,y=data3$pos_front/1000, mode = 'lines')%>%
  layout(title = ls[3],
  xaxis = list(title = 'Angle'),
  yaxis = list(title = 'Position'))
## No trace type specified:
##   Based on info supplied, a 'scatter' trace seems appropriate.
##   Read more about this trace type -> https://plot.ly/r/reference/#scatter
plot_ly(x=data4$angle/1000,y=data4$pos_front/1000, mode = 'lines')%>%
  layout(title = ls[4],
  xaxis = list(title = 'Angle'),
  yaxis = list(title = 'Position'))
## No trace type specified:
##   Based on info supplied, a 'scatter' trace seems appropriate.
##   Read more about this trace type -> https://plot.ly/r/reference/#scatter

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.