@@ -201,6 +201,50 @@ function display_center_guess(){
201201 append_in_ui ( "svg_id" , thehtml )
202202}
203203
204+ var old_point_color = "#dedede"
205+
206+ var cal_saved_points_old
207+
208+ function DisplayOldEyePoints ( J_num )
209+ {
210+ let thehtml = ""
211+
212+ read_file_async ( "Dexter.default:/srv/samba/share/cal_data/OldEyeData.json" , "utf-8" ,
213+ function ( err , data )
214+ {
215+ if ( err ) { //only call the callback for the read IF there's a read error.
216+ out ( "No previous eye to read from! This is normal if this robot is new or was last calibrated before May 5, 2022." )
217+ }
218+ else {
219+ out ( "DisplayOldEyePoints(): " + data )
220+ if ( ! data . startsWith ( "Error" ) )
221+ {
222+ cal_saved_points_old = JSON . parse ( data )
223+
224+
225+ if ( cal_saved_points_old ) // Noah: Need to officially define cal_saved_points_old from exported file
226+ {
227+ let points_old = cal_saved_points_old [ J_num - 1 ]
228+ if ( points_old [ 0 ] ) //Plots old points from last calibration
229+ {
230+ let num_points_old = points_old [ 0 ] . length
231+ for ( let i = 0 ; i < num_points_old ; i ++ )
232+ {
233+ thehtml = ( svg_circle ( { html_class : "cal_svg_circle" , cx : points_old [ 0 ] [ i ] , cy : flip_point_y ( points_old [ 1 ] [ i ] ) , r : 1 , border_color : old_point_color , color : old_point_color } ) )
234+ append_in_ui ( "svg_id" , thehtml )
235+ }
236+ }
237+ }
238+ }
239+ else
240+ {
241+ out ( "No previous eye to read from! This is normal if this robot is new or was last calibrated before May 5, 2022." )
242+ }
243+ }
244+ }
245+ )
246+ }
247+
204248function init_view_eye ( ) {
205249 //this table has to be here rather than top level in the file even though it is static,
206250 //because _nbits_cf and the other units cause errors if referenced at top level.
@@ -215,7 +259,13 @@ function init_view_eye(){
215259 new Job ( { name : "CalSensors" , keep_history : true , show_instructions : false ,
216260 inter_do_item_dur : .5 * _ms ,
217261 robot : cal_get_robot ( ) ,
218- do_list : [ Dexter . move_all_joints ( 0 , 0 , 0 , 0 , 0 ) ,
262+ do_list : [
263+ function ( )
264+ {
265+ let J_num = window . cal_working_axis + 1
266+ DisplayOldEyePoints ( J_num )
267+ } ,
268+ Dexter . move_all_joints ( 0 , 0 , 0 , 0 , 0 ) ,
219269 Robot . label ( "loop_start" ) ,
220270 make_ins ( "w" , 42 , 64 ) ,
221271 make_ins ( "S" , "J1BoundryHigh" , 648000 * _arcsec ) ,
@@ -255,7 +305,8 @@ function init_view_eye(){
255305 let start_button_dom_elt = window [ "Start_J_" + J_num + "_id" ]
256306 start_button_dom_elt . style . backgroundColor = "rgb(230, 179, 255)"
257307 cal_instructions_id . innerHTML =
258- "Click in the center of the dot_pattern circle.<br/>" }
308+ "Click in the center of the dot_pattern circle."
309+ }
259310 ] } )
260311 cal_init_view_eye_state = false
261312}
0 commit comments