diff --git a/HCA/HCA_ui.js b/HCA/HCA_ui.js index 7322e928..3f986cf6 100644 --- a/HCA/HCA_ui.js +++ b/HCA/HCA_ui.js @@ -193,6 +193,9 @@ var HCA = class HCA { insert_html_into_doc_pane(html, "User Guide", "beforeend") open_doc(hca_ui_doc_id) } + const ctx = HCA_canvas_id.getContext("2d"); + ctx.fillStyle = "rgb(200, 0, 0)"; + ctx.fillRect(10, 10, 50, 50); } static clear(){ diff --git a/HCA/ipg_to_json.js b/HCA/ipg_to_json.js index 3400d991..dd5d6bde 100644 --- a/HCA/ipg_to_json.js +++ b/HCA/ipg_to_json.js @@ -47,7 +47,7 @@ globalThis.ipg_to_json = class ipg_to_json{ let section = null for(let line_index = 0; line_index < lines.length; line_index++){ let line = lines[line_index] - console.log("line index: " + line_index + ":" + line) + //console.log("line index: " + line_index + ":" + line) //initial meta-data if(line.startsWith("VIVA ")) { let split_line = line.split(" ") @@ -58,7 +58,7 @@ globalThis.ipg_to_json = class ipg_to_json{ } else if(line.startsWith("DataSet ")) { if(!result.datasets) { - console.log("DATASETS") + //console.log("DATASETS") result.datasets = {} } let dataset_obj = this.parse_dataset(line) @@ -84,7 +84,7 @@ globalThis.ipg_to_json = class ipg_to_json{ //Behavior Topology (net_list) else if (line.startsWith(" //_ Behavior Topology")){ - console.log("NETLIST") + //console.log("NETLIST") section = "netList" top_level_obj.netList = [] } @@ -234,7 +234,7 @@ globalThis.ipg_to_json = class ipg_to_json{ } let outputs_str = before_comment.substring(outputs_start_pos + 1, outputs_end_pos).trim() */ - console.log("grabbing outputs: ") + //console.log("grabbing outputs: ") let out_arr_and_end = this.grab_io(before_comment, space_after_Object_pos + 1) //this.io_string_to_obj_array(outputs_str) out_array_result = out_arr_and_end[0] outputs_end_pos = out_arr_and_end[1] @@ -264,7 +264,7 @@ globalThis.ipg_to_json = class ipg_to_json{ let [name, name_end_pos] = this.grab_name(before_comment, name_start_pos) //before_comment.substring(name_start_pos, name_end_pos).trim() //if(name.startsWith('"')) { name = name.substring(1, name.length - 1) } //cut off double quotes in name that are *sometimes* present let [type, name_ext] = name.split(":") //name_ext is included in name, we don't use it separately - console.log("objectName: " + name) + //console.log("objectName: " + name) new_obj.objectName = name new_obj.objectType = type //the part of the name that's before the colon @@ -286,7 +286,7 @@ globalThis.ipg_to_json = class ipg_to_json{ //will be name, type, inputs, outputs, x, y, font ... //parse comment if(comment) { //only happens for sub_objects - console.log("grabbing comments: " + comment) + //console.log("grabbing comments: " + comment) if(comment.startsWith("_GUI ")){ let comment_start = 5 comment = comment.substring(comment_start) diff --git a/core/index.js b/core/index.js index 3367ffc2..853bf711 100644 --- a/core/index.js +++ b/core/index.js @@ -1,5 +1,5 @@ -global.dde_version = "3.8.9" //require("../package.json").version -global.dde_release_date = "Sep 30, 2022" //require("../package.json").release_date +global.dde_version = "3.8.10" //require("../package.json").version +global.dde_release_date = "Oct 22, 2022" //require("../package.json").release_date console.log("dde_version: " + global.dde_version + " dde_release_date: " + global.dde_release_date + "\nRead electron_dde/core/job_engine_doc.txt for how to use the Job Engine.\n") @@ -118,6 +118,10 @@ function run_shell_cmd_default_cb (error, stdout, stderr){ function run_shell_cmd(cmd_string, options={}, cb=run_shell_cmd_default_cb){ exec(cmd_string, options, cb) } +var child_process = require("child_process") +var WebSocket = require('ws') + +var Socket = require("./socket.js") var {adjust_path_to_os, append_to_file, choose_file, choose_save_file, choose_file_and_get_content, choose_folder, @@ -176,6 +180,9 @@ var {Messaging, MessStat} = require("./messaging.js") var {Py} = require("./py.js") // see also je_and_browser_code.js for global vars. +global.child_process = child_process +global.WebSocket = WebSocket +global.Socket = Socket global.keep_alive_value = false global.Brain = Brain global.Dexter = Dexter @@ -238,7 +245,10 @@ global.persistent_get = persistent_get global.persistent_remove = persistent_remove global.persistent_save = persistent_save global.read_file = read_file +global.read_file_async = read_file_async global.write_file = write_file +global.write_file_async = read_file_async + global.close_readline = close_readline diff --git a/core/je_and_browser_code.js b/core/je_and_browser_code.js index d6d7377e..59727a3c 100644 --- a/core/je_and_browser_code.js +++ b/core/je_and_browser_code.js @@ -124,7 +124,7 @@ function out(val="", color="black", temp=false, code=null){ } if(window.platform == "node") { //console.log(val) let out_obj = {kind: "out_call", val: text, color: color, temp: temp, code: code} //code isn't actually used in the browser - write_to_stdout("" + JSON.stringify(out_obj) + "") + write_to_stdout("" + JSON.stringify(out_obj) + "\n") return val } @@ -1010,7 +1010,7 @@ SW.window_index = null // The window_index of the last show_window made, or null function selector_set_in_ui(path_string, value=null){ if(window.platform == "node") { //console.log(val) let obj = {kind: "selector_set_in_ui_call", path_string: path_string, value: value} - write_to_stdout("" + JSON.stringify(obj) + "") + write_to_stdout("" + JSON.stringify(obj) + "\n") } else { if(value === -0) { value = 0 } //in some weird raoujnding situations, we get a negative zero. @@ -1100,7 +1100,7 @@ function selector_set_in_ui(path_string, value=null){ function append_in_ui(path_string, new_html){ if(window.platform == "node") { //console.log(val) let obj = {kind: "append_in_ui_call", path_string: path_string, new_html: new_html} - write_to_stdout("" + JSON.stringify(obj) + "") + write_to_stdout("" + JSON.stringify(obj) + "\n") } else { let elt = value_of_path(path_string) diff --git a/core/job.js b/core/job.js index 29b5f82b..72acdc38 100644 --- a/core/job.js +++ b/core/job.js @@ -1033,7 +1033,7 @@ class Job{ } else { //job engine let data = {kind: "show_job_button", job_name: this.name, status_code: this.status_code, button_color: bg_color, button_tooltip: tooltip} - write_to_stdout("" + JSON.stringify(data) + "") + write_to_stdout("" + JSON.stringify(data) + "\n") } } //end of jobs buttons diff --git a/core/out.js b/core/out.js index b94fdb24..6854be12 100644 --- a/core/out.js +++ b/core/out.js @@ -309,7 +309,7 @@ function show_window({content = ``, } else { //onsole.log("bottom of show_window writing to stdout") - write_to_stdout("" + JSON.stringify(props) + "") + write_to_stdout("" + JSON.stringify(props) + "\n") } return SW.window_index } diff --git a/core/robot.js b/core/robot.js index 846f1d10..3b8c9d82 100644 --- a/core/robot.js +++ b/core/robot.js @@ -1766,8 +1766,10 @@ Dexter.empty_instruction_queue_immediately = function(){ } Dexter.prototype.empty_instruction_queue_immediately = function(...args){ args.push(this); return Dexter.empty_instruction_queue_immediately(...args) } -Dexter.empty_instruction_queue = function() { return make_ins("F") } -Dexter.prototype.empty_instruction_queue = function(...args){ args.push(this); return Dexter.empty_instruction_queue(...args) } +Dexter.empty_instruction_queue = function(...args) { + return make_ins("F", ...args) +} +Dexter.prototype.empty_instruction_queue = function(){ return Dexter.empty_instruction_queue(this) } Dexter.find_index = function(...args){ return make_ins("n", ...args) } Dexter.prototype.find_index = function(...args){ args.push(this); return Dexter.find_index(...args) } @@ -2575,9 +2577,15 @@ Dexter.prototype.set_link_lengths = function(job_to_start_when_done = null) { } else if (job_to_start_when_done.get_dexter_defaults) { if (sim_actual !== true) { //ie "real" - if (node_server_supports_editor(this)) { + if (globalThis.platform == "node") { + //just get the file. + this.set_link_lengths_using_node_server(job_to_start_when_done) + + } + else if (node_server_supports_editor(this)) { this.set_link_lengths_using_node_server(job_to_start_when_done) - } else { + } + else { job_to_start_when_done.stop_for_reason("errored_from_dexter_connect", "While attempting to set_link_lengths, " + " can't connect to Dexter." + this.name) diff --git a/core/socket.js b/core/socket.js index 8d309b1b..a0bb2dfd 100755 --- a/core/socket.js +++ b/core/socket.js @@ -124,7 +124,10 @@ var Socket = class Socket{ "\n failed after 2 seconds.") } }, 2000) - net_soc_inst.connect(rob.port, rob.ip_address) + let ip_addr = rob.ip_address + if (ip_addr == "localhost") ip_addr = "127.0.0.1" // net.connect wants a number as a string + console.log("Socket.init trying to connect to port:"+rob.port+" ip:"+ip_addr) + net_soc_inst.connect(rob.port, ip_addr) } //ending the case where we need to make a new net_soc_inst /*out(job_instance.name + "Socket.init before connect, net_soc_inst.readyState: " + net_soc_inst.readyState) diff --git a/core/storage.js b/core/storage.js index ac8d07b6..926c797b 100644 --- a/core/storage.js +++ b/core/storage.js @@ -367,9 +367,9 @@ function read_file_async_from_dexter_using_job(dex_instance, path, callback){ let colon_pos = path.indexOf(":") let dex_file_path = path.substring(colon_pos + 1) new Job({name: "dex_read_file", - robot: dex_instance, + robot: new Brain({name: "b1"}), do_list: [ - Dexter.read_file(dex_file_path, "file_content"), + dex_instance.read_file(dex_file_path, "file_content"), function(){ let cont = this.user_data.file_content if(typeof(cont) == "string"){ @@ -1291,6 +1291,7 @@ var app = require('electron').remote; //in the electron book, "app" is sp var {Robot, Brain, Dexter, Human, Serial} = require("./robot.js") var {shouldnt, starts_with_one_of, replace_substrings} = require("./utils") var Job = require("./job.js") //because loading a file with new Job in it needs this. +var {value_of_path} = require('./utils.js'); diff --git a/doc/guide.html b/doc/guide.html index 72a6cd02..97133b3e 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -8,8 +8,8 @@
About This is Dexter Development Environment
- version: 3.8.8
- released: Sep 30, 2022 + version: 3.8.10
+ released: Oct 22, 2022

DDE helps you create, debug, and send software to a Dexter robot. You can use any JavaScript augmented with DDE-specific functions to help find out about, diff --git a/doc/known_issues.html b/doc/known_issues.html index cc019cfa..d5e07021 100644 --- a/doc/known_issues.html +++ b/doc/known_issues.html @@ -42,7 +42,6 @@ to turn off virus protection, or click right on the dexter_dev_env file to launch it. -
  • Linux release poorly tested.
  • Dexter.run_gcode needs many extensions.
  • \ No newline at end of file diff --git a/doc/release_notes.html b/doc/release_notes.html index 814195c0..736a47cf 100644 --- a/doc/release_notes.html +++ b/doc/release_notes.html @@ -5,6 +5,25 @@ } .doc_details summary { font-weight: 600; } +
    v 3.8.10, Oct 22, 2022 + Highlights: Job Engine Improvements, Dexter UI tutorial Improvements. + +
    v 3.8.9, Sep 30, 2022 Highlights: Bug fixes. @@ -14,7 +33,7 @@ causing problems.
  • robot_status.js now properly usesDexter.J1_MEASURED_ANGLE_G1 instead of 10. This does not change functionality.
  • -
  • Inspector: 4 "extra info" infinite loop bugs fixed.
  • > +
  • Inspector: 4 "extra info" infinite loop bugs fixed.
  • Fixed bug in core/index.js for the folder of the require statement that loads dexter_defaults.js
  • Fixed bug in storage.js of the default value for outerWidth and outerHeight.
  • diff --git a/package.json b/package.json index 4070dc64..f8e765dc 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "dexter_dev_env", "productName": "dexter_dev_env", - "version": "3.8.9", - "release_date": "Sep 30, 2022", + "version": "3.8.10", + "release_date": "Oct 22, 2022", "description": "Dexter Development Environment for programming the Dexter robot.", "author": "Fry", "license": "GPL-3.0", diff --git a/tutorials/dexter_ui_tutorial.js b/tutorials/dexter_ui_tutorial.js index 8630dbbf..4d6e40a8 100644 --- a/tutorials/dexter_ui_tutorial.js +++ b/tutorials/dexter_ui_tutorial.js @@ -60,22 +60,24 @@ dui_tour.addSteps([ select real to move a real robot.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 20] } }]}, }, - {attachTo: {element: '#warning_moving_dexter', on: 'top'}, + {classes: "shepherd_step_dui_wide", text: `Using this tutorial with real selected will move Dexter. Please clear its surrounding area and move Dexter slowly.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 20] } }]}, - }, + }, {text: `If you didn't see the Dexter User Interface dialog box just pop up, - check the lower left Output pane in DDE for warnings. + please try: + + Otherwise, just click Next.`, when: { show() { const currentStepElement = dui_tour.currentStep.el; @@ -93,9 +95,18 @@ dui_tour.addSteps([ } }, }, + {attachTo: {element: '.dui_dialog [name=direction_checkbox]', on: 'top'}, + + text: `Often you want Dexter's end effector pointed down to work on the table surface. + But for this tutorial, its easiest to not use that constraint.
    + Please uncheck this checkbox.`, + popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 15] } }]} + }, {attachTo: {element: '.dui_dialog [name=j2_range]', on: 'left'}, - text: `Drag the joint 2 slider very slowly for just a short distance. + text: `Observe that under the big red square, the "J2" slider is highlighted.
    + ("J2" stands for Dexter's joint 2.)
    + Drag the joint 2 slider very slowly for just a short distance. (Dexter has a maximum speed that's slower than you can drag.)
    Observe that the simulated Dexter's joint 2 changes.
    Notice that other controls' values change in concert.`, @@ -110,6 +121,19 @@ dui_tour.addSteps([ Notice that other controls change too.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 30] } }]} }, + {classes: "shepherd_step_dui_wide", + text: `There are two basic ways to move Dexter. +
      +
    1. Move the joints. This is low level and gives you explicit control + of the angle of each joint, independent of the other joints.
    2. +
    3. Move Dexter's end effector to a particular x, y, z coodinate. + This is higher level and often more useful for practical positioning.
    4. +
    + The Dexter UI dialog box helps you understand the relationship between these + two coordinate systems, an important concept called Kinematics.`, + buttons: [{text: 'Next', action: dui_tour.next}], + }, + {attachTo: {element: '.dui_dialog [name=z_slider]', on: 'right'}, text: `Drag the Z slider's dot slowly to move Dexter's end effector vertically. @@ -131,20 +155,20 @@ dui_tour.addSteps([ popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 20] } }]} }, - {attachTo: {element: '.dui_dialog [name=j1_angle_num]', on: 'bottom'}, + {attachTo: {element: '.dui_dialog [name=j5_angle_num]', on: 'top'}, text: `You can specify Dexter's movements more accurately by using the numerical controls. - Change joint 1 by using the highlighted control. + Change joint 5 by using the highlighted control. Use its up and down arrows to increment or decriment - joint 1's degrees without typing. - Dexter will move slowly in response.`, + joint 5's degrees without typing. + Dexter will barely move in response.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 5] } }]} }, {attachTo: {element: '#editor_pane_id', on: 'top-start'}, text: `A Job contains the sequence of instructions that reproduce - a complex process. Let's create a Job.
    + a complex process. Let's create a Job.

    DDE has 4 panes. The upper left one (now highlighted) - is the Editor pane.
    + is the Editor pane.
    If it has text in it, click on its File menu and select New to give us an empty editor.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, -50] } }]} @@ -159,17 +183,16 @@ dui_tour.addSteps([ This will insert the JavaScript for an instruction that tells Dexter to move to where it currently is.`, }, - {attachTo: {element: 'body' , on: 'right'}, + {attachTo: { element: '.dui_dialog', on: 'left'}, + text: `Drag the title bar of the dialog box right, + so that you can see at least the first argument + of the inserted instruction.` + }, + {attachTo: {element: '.dui_dialog [name=j1_range]' , on: 'top'}, text: `Modify the new instruction
    by dragging the joint 1 slider. This changes not just the robot and other controls, - but joint 1's argument in the editor too.
    - An instruction's arguments are often hidden by the - Dexter UI dialog box. Drag its title bar so you can see - the inserted instructions in the editor. - If you are using the simulator, try to position - the dialog so you can still see the simulated Dexter. - `, + but joint 1's argument in the editor too.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 5] } }]} }, {attachTo: {element: '.dui_dialog', on: 'right'}, @@ -179,9 +202,12 @@ dui_tour.addSteps([ (bottom-right).`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 0] } }]} }, - {attachTo: {element: '.dui_dialog [name=step_arrow_buttons]', on: 'right'}, + {attachTo: {element: '.dui_dialog [name=step_arrow_buttons]', on: 'bottom'}, text: `Run individual instructions,
    or many at once,
    using the green arrow buttons.
    + The small green arrows allow you to step through each instruction, + forwards or back. Very useful in debugging. +

    Start with the small, left pointing arrow, to run the previous instruction.
    Notice that the previoius instruction becomes selected in the editor.
    @@ -209,22 +235,24 @@ dui_tour.addSteps([ text: `The Eval button runs the selected JavaScript code in the editor.
    Click it now to evaluate the selection.
    - In the Output pane you'll see the internal data structure + In the Output pane you'll see, in the inspector, the internal data structure that represents the instruction, but this does not cause - Dexter to move until its run as part of a Job.`, + Dexter to move until it is run as part of a Job.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 10] } }]} }, {attachTo: {element: '#editor_pane_id', on: 'bottom-start'}, text: `If there is no selection, the Eval button evaluates all the code in the editor.
    Click anywhere in the editor to remove the selection - and get help on the underlying source code.
    + and get help on the underlying source code in the output pane. `, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 10] } }]} }, {attachTo: {element: '#eval_id', on: 'right'}, text: `We want to evaluate the JavaScript for the whole Job - to define it. Click the Eval button.`, + to define it.
    + Click the Eval button.
    + Observe the data structure representing the Job in the inspector.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 10] } }]} }, {attachTo: {element: '#jobs_button_bar_id', on: 'bottom'}, @@ -234,13 +262,30 @@ dui_tour.addSteps([ in the Job.`, popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 0] } }]} }, + {attachTo: {element: '#jobs_button_bar_id', on: 'top'}, + text: `The color of a Job's button indicates its state: + + Place the mouse over a Job button to see text of it's state.`, + popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 0] } }]} + }, + {attachTo: {element: '#jobs_button_bar_id', on: 'bottom'}, + text: `Click my_job's button to run it again.
    + You can run a Job as many times as you like.`, + popperOptions: {modifiers: [{ name: 'offset', options: { offset: [0, 0] } }]} + }, {attachTo: { element: '.dui_dialog', on: 'right'}, text: `We're almost done so
    close the Dexter UI dialog by
    clicking the X in its upper right corner` }, {attachTo: { element: '#editor_pane_id', on: 'left'}, - text: `Get the Dexter UI dialog back by clicking
    + text: `Get the Dexter UI dialog back by clicking on the Jobs menu's Dexter UI item.` }, {attachTo: { element: '#doc_pane_id', on: 'left'}, @@ -249,19 +294,21 @@ dui_tour.addSteps([ that describes the Dexter UI dialog.
    There's more to it than this tutorial covers.` }, - {attachTo: { element: '#help_system_id', on: 'left'}, + {attachTo: { element: '#help_system_id', on: 'left'}, text: `Clicking the Help button will bring back the "Welcome to DDE" dialog box containing the tutorials menu.` }, {classes: "shepherd_step_dui_wide", - text: `Congrats, You're a Dexter Process Author!
    + text: `Congrats!
    You're a Dexter Process Author!
    When you click Exit, you'll have unrestricted access to the: -