-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInternal_Readings.js
73 lines (65 loc) · 1.98 KB
/
Internal_Readings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//A2D Data
var J1_SIN = [];
var J1_COS = [];
var J1_MEASURED_ANGLE = [];
var J1_DELTA = [];
function print_encoder_data(JobIdent){
let data = [JobIdent.robot.robot_status[Dexter.J5_A2D_SIN],
JobIdent.robot.robot_status[Dexter.J5_A2D_COS],
JobIdent.robot.robot_status[Dexter.J5_MEASURED_ANGLE],
JobIdent.robot.robot_status[Dexter.J5_DELTA]]
return data
}
new Job({
name: "my_job",
inter_do_item_dur: 0.01,
do_list: [
Dexter.move_all_joints([1.8,0,0,0,0]),
function(){Saved_data = [];},
Robot.loop(100, function(){
let rt = [];
rt.push(Dexter.get_robot_status())
rt.push(function (){
let Measured_data = print_encoder_data(this)
J1_SIN.push(Measured_data[0])
J1_COS.push(Measured_data[1])
J1_MEASURED_ANGLE.push(Measured_data[2])
J1_DELTA.push(Measured_data[3])
Saved_data.push(Measured_data)
write_file("J1_Encoder_Data.csv", Saved_data)
})
return rt})
]
})
function plotJ1(){
var trace1 = {type: "scatter", mode: "lines+markers",
y: J1_SIN, name: "J1_SIN"};
var trace2 = {type: "scatter", mode: "lines+markers",
y: J1_COS, name: "J1_COS"};
var data = [trace1,trace2];
var layout = {title: "Dexter J1 Encoder Data ",
width: 900, height: 400,x: 100, y: 100};
var zoom = {scrollZoom: true}
Plot.show(null,data,layout,zoom)}
function plotJ1Ang(){
var trace1 = {type: "scatter", mode: "lines+markers",
y: J1_MEASURED_ANGLE, name: "J1_MEASURED_ANGLE"};
var trace2 = {type: "scatter", mode: "lines+markers",
y: J1_DELTA, name: "J1_DELTA"};
var data = [trace1,trace2];
var layout = {title: "Dexter J1 Encoder Data ",
width: 900, height: 400,x: 100, y: 100};
var zoom = {scrollZoom: true}
Plot.show(null,data,layout,zoom)}
new Job({
name: "Plot_J1",
do_list: [
plotJ1,
]
})
new Job({
name: "Plot_JAng",
do_list: [
plotJ1Ang,
]
})