Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
cfry committed Nov 18, 2018
1 parent 72abba9 commit 300634d
Show file tree
Hide file tree
Showing 15 changed files with 393 additions and 64 deletions.
26 changes: 21 additions & 5 deletions de/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ npm install pegjs --save
DE.make_verb_rule_expers()
*/
var DE = class DE {
static de_to_js(de_src) { return DE.parser.parse(de_src) }
static de_to_js(de_src) {
let tracer_instance = new DE.PegTracer(de_src,{
parent:null,
hiddenPaths:[],
useColor:false,
showTrace:true,
maxSourceLines:6,
maxPathLength:72,
})
return DE.parser.parse(de_src, {tracer: tracer_instance})
}

static make_verb_rule_expers() {
let result = ""
Expand Down Expand Up @@ -59,15 +69,17 @@ DE.ops = {"less than": "<",
"times": "*",
"divide": "/",
"remainder" : "%",
"to the power of": "**",
"power": "**",

"also": "&&",
"or": "||"
}
DE.peg = require("pegjs")
DE.PegTracer = require('pegjs-backtrace');

DE.parser = DE.peg.generate(
`start = result:expr { return result }
expr = before_com:comment* ws_or_not result:(fn_def / assignment / string1 / maker / sentence / path / variable / undefined / number) ws_or_not after_com:comment*
expr = before_com:comment* ws_or_not result:(fn_def / assignment / maker / sentence / string1 / path / variable / undefined / number) ws_or_not after_com:comment*
{ return before_com + result + after_com }
maker = "make" ws (("an" / "a") ws)? subj:subject ws "with" ws args:arguments? sent_end
{ if (subj == "Array") {
Expand Down Expand Up @@ -128,7 +140,11 @@ sent_end = ws_or_not "." {
}
subject = result:(path / variable / number) { return result }
verb = ` + DE.make_verb_rule_expers() + ` { return text() }
verb = ` + DE.make_verb_rule_expers() + ` {
let result = text()
console.log("got verb: " + result)
return text()
}
arguments = var_num1:argument var_nums:(arg_sep argument)* {
let args = var_num1
debugger
Expand Down Expand Up @@ -157,7 +173,7 @@ argument = arg_name:(variable ws "of" ws)? the_expr:expr {
console.log("got arg: " + result)
return
}
arg_sep "arg_sep" = ws_or_not ("and" / ",") ws_or_not { return ", " }
arg_sep "arg_sep" = (ws "and" ws) / (ws_or_not "," ws_or_not) { return ", " }
Expand Down
2 changes: 1 addition & 1 deletion de/de_testsuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ new TestSuite("DE arithmetic",
['DE.de_to_js("45 times with 46 and 47.")', '"(45 * 46 * 47)"'],
['DE.de_to_js("45 divide with 9.")', '"(45 / 9)"'],
['DE.de_to_js("45 remainder with 10.")', '"(45 % 10)"'],
['DE.de_to_js("2 to the power of with 3.")', '"(2 ** 3)"']
['DE.de_to_js("2 power with 3.")', '"(2 ** 3)"']
)

new TestSuite("DE logic",
Expand Down
3 changes: 0 additions & 3 deletions doc/known_issues.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
with this DDE release. All of them are on our "do list".
<p></p>
<ul>
<li> <i>Sometimes</i> a job run near the begining of a DDE session will pause
for an extra 30 seconds at its beginning. This slowdown is a bug that we're
investigating.</li>
<li>Picture.detect_blobs: the data about each blob is inconsistent with
itself. detect_blobs <i>appears</i> to work but actual x, y locations
for each blob are wrong.</li>
Expand Down
34 changes: 20 additions & 14 deletions doc/ref_man.html
Original file line number Diff line number Diff line change
Expand Up @@ -3024,9 +3024,15 @@
<a target="_blank" href="http://hdrobotic.com/webinar#advanced_jobs" target="_blank">Advanced Jobs</a><br/>

<details id="new_job_parameters_doc_id" class="doc_details"><summary>new Job parameters</summary>
The parameters used to define a new Job are:
<ol><li><b>name</b> You can use <code title="unEVALable code fragment"> Job.a_job_name</code> to get the instance programmatically.</li>
<li><b>robot</b> An instance of one of the subclasses of <code>Robot</code>, such as
The parameters used to define a new Job all have defaults.<br/>
<code> new Job() </code><br/>
is a valid job to define and run, though it will give a warning message:<br/>
<span style="color:#e50;">Warning: While starting job: job_1, the do_list is empty.<br/>
The job still requests the status of Dexter but does not cause it to move.</span><br/>
You can customize a job with the parameters:
<ol><li><b>name</b> Default's to an unused name of the format: <code>"job_1"</code>, <code>"job_2"</code>, <code>"job_3"</code>, etc.
You can use <code title="unEVALable code fragment"> Job.a_job_name</code> to get the instance programmatically.</li>
<li><b>robot</b> Default: <code>Robot.dexter0</code> An instance of one of the subclasses of <code>Robot</code>, such as
<code>Dexter</code>. This is the <i>default</i> robot to send the job's instructions to if
the instruction itself doesn't designate a robot. The default for a Job's default robot is
<code>Robot.dexter0</code>. For example, if we have:
Expand All @@ -3039,7 +3045,7 @@
instruction so that you can have one job that feeds instructions to
multiple serial robots as well as multiple Dexters.
</li>
<li id="do_list_doc_id"><b>do_list</b> An array of instructions to be sent to the job's robot when the
<li id="do_list_doc_id"><b>do_list</b> Default: <code>[]</code> (an empty array). An array of instructions to be sent to the job's robot when the
Job is run. There are a number of different kinds of instructions, including
user-defined JavaScript functions that can call arbitrary JS code.
<p></p>
Expand Down Expand Up @@ -3078,7 +3084,7 @@
For a list of valid instructions, see
<a href="#" onclick="open_doc(robot_instructions_doc_id)">Robot Instructions</a>
</li>
<li><b>keep_history</b> true or false, default true. If true, the robot_status arrays
<li><b>keep_history</b> true or false, Default: <code>true</code>. If true, the robot_status arrays
returned from running instructions on the robot
are stored in <code title="unEVALable code fragment"> Job.the_job_name.rs_history</code>.
This is useful for debugging, but uses memory, which can be
Expand All @@ -3098,13 +3104,13 @@
</ul>
See <a href="#" onclick="open_doc(print_statements_doc_id, event)">print statements</a>
</li>
<li><b>inter_do_item_dur</b> A number indicating the number of seconds between
<li><b>inter_do_item_dur</b> Default: <code>0.01</code> A number indicating the number of seconds between
when an instruction is completed by its robot, and when the next instruction is
computed and sent to the robot of the job. This "taking a breath" gives other
jobs a chance to run. Default 100.</li>
<li><b>user_data</b> A literal object of name-value pairs where arbitrary data created
<li><b>user_data</b> Default <code>{}</code> (an empty object). A literal object of name-value pairs where arbitrary data created
at the beginning of a job or during the execution of an instruction can be stored
and retrieved. Default <code>{}</code> (an empty object).
and retrieved.
It can be initialized in the call to new job like so:<br/>
<code>new Job ({name:"j22", user_data:{color: "blue", weight: 123} })</code><br/>
Within an instruction, you can get a user_data value via
Expand Down Expand Up @@ -3162,23 +3168,23 @@
))]})
</code></pre>
</li>
<li><b>program_counter</b> Initialize the program_counter to an instruction id.
The default is 0. You can use any instruction_location here.
<li><b>program_counter</b> Default: <code>0</code> Initialize the program_counter to an instruction id.
This is most commonly a non-negative integer but
you can use any instruction_location here.
See <a href="#" onclick="open_doc('Robot.go_to_doc_id', event)">Robot.go_to</a>
for documentation on all the different kinds of instruction_locations.
</li>
<li><b>ending_program_counter</b> Declare at the outset of a job that it
<li><b>ending_program_counter</b> Default: <code>"end"</code> Declare at the outset of a job that it
will not execute the indicated instruction or beyond. This can be any
valid instruction_location that does not include a job. It is evaluated
at the start of each instruction, so if labels move as a result of
dynamically added instructions, that's OK.
The default is "end".
See <a href="#" onclick="open_doc('Robot.go_to_doc_id', event)">Robot.go_to</a>
for documentation on all the different kinds of instruction_locations.
</li>
<li><b>initial_instruction</b> Add an initial instruction to the do_list at
<li><b>initial_instruction</b> Default <code>null</code> (no instruction added).Add an initial instruction to the do_list at
the location of program_counter. Thus this instruction will be executed
first when the job is run. Default null (no instruction added).
first when the job is run.
</li>
<li><b>when_stopped</b> controls what happens when a job stops normally.<br/>
<i>Possible Values</i>:<br/>
Expand Down
54 changes: 54 additions & 0 deletions doc/release_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,60 @@
.doc_details summary { font-weight: 600; }
</style>

<details class="doc_details"><summary>v 2.5.12, Nov 18, 2018</summary>
Highlights: new Job() with no args now works. Many bug fixes.
<ul>
<li>Now when a new job is started that is connected to a robot,
if that robot is connected to a socket,
that robot's socket connection is destroyed then a new one is created.</li>

<li> Output pane horizontal scroll bar at bottom is now visible when
the content of the output pane exceeds the output pane width.</li>

<li> Fixed typo in <code>move_all_joints_relative</code> implementation name.</li>

<li> robot_status dialog: Removed "m" at end of "no status" for measured angles.
Improved formatting of measured angle number.</li>

<li> robot status dialog: No longer displays scroll bars when empty of content.</li>

<li> robot status dialog: fixed <b>Measured X, Y, Z</b> displayed numbers.
Prefixed the header for these fields with "J5".</li>

<li> robot status dialog: When 2 robots are being used,
only the data from the selected robot in the robot status dialog is
shown. Previously, data from other robots could have been shown.</li>

<li> robot status dialog: At most, only one robot status dialog will be shown.
Attempting to show a 2nd one will result in a warning message.</li>

<li> Fixed socket.js <code>instruction_array_degrees_to_arcseconds_maybe</code> conversion to dynamixel
units for Joint 6 and 7.
Also corresponding change of subtracting 512 from
convert_robot_status_to_degrees' J6.</li>

<li> Swapped the positions of J6 and J7 measured angles in the robot status
array to conform to Dexrun.c's filling in of these values.
This fixes a bug in displaying those values in the robot status dialog box.</li>

<li> In making a new Job, the do_list arg is no longer required.
You can now let a defined's job do_list
default to the empty list. That will cause the warning message:
Warning: While starting job: job_1 the do_list is empty.
The job still requests the status of Dexter, but does not cause it to move.
Now <code>new Job()</code> is a valid Job that can be defined and run without error.</li>

<li> Ref Man: Improved <b>new Job parameters</b> documentation for default values.</li>

<li> <code>new Job when_stopped</code> arg: when this is a fn, the job is now stopped.
Only when the arg is <code>"wait"</code> is the job not stopped.</li>

<li> Fixed bug in <code>Dexter.read_from_robot</code> that prevented it from
being used twice in a job.
</li>
</ul>
</details>

<details class="doc_details"><summary>v 2.5.11, Nov 11, 2018</summary>
Highlights: New "Ping" item on Jobs menu, bug fixes & tweaks.
<ul>
Expand Down
2 changes: 0 additions & 2 deletions editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ require("codemirror/addon/fold/brace-fold.js")
require("codemirror/addon/fold/comment-fold.js")
*/

const ipcRenderer = require('electron').ipcRenderer

var myCodeMirror

function Editor(){} //just a namespace of *some* internal fns
Expand Down
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<script type="text/javascript" src="instruction.js"></script>
<script type="text/javascript" src="robot.js"></script>
<script type="text/javascript" src="robot_status.js"></script>
<script type="text/javascript" src="robot_status_dialog.js"></script>
<script type="text/javascript" src="dextersim.js"></script>

<script type="text/javascript" src="job.js"></script>
Expand Down Expand Up @@ -545,7 +546,7 @@
<!--<li id="start_job_id" title="Eval job that cursor is in and start it.">Start Job
<ul><li id="start_job_help_id">Start Job Help</li></ul>
</li>-->
<li id="show_robot_status_id" title="Pop up a dialog showing the robot status&#013;for a Dexter of your choosing.&#013;Display updates after each instruction.">Show robot status</li>
<li id="show_robot_status_id" title="Pop up a dialog showing the robot status&#013;for a Dexter of your choosing.&#013;It displays updates as soon as they are available.">Show robot status</li>
<li id="jobs_report_id" title="Display a report of all Jobs in this session.">Show report</li>
<!--<li id="stop_all_jobs_id" title="Stop all of the currently running jobs.">Stop all jobs</li> -->
<!-- <li id="clear_stopped_jobs_id" title="Remove stopped jobs so they don't clutter the jobs report.">Clear stopped jobs</li> -->
Expand Down Expand Up @@ -706,7 +707,7 @@
</div>
</div>
</div>
<div id="output_div_id" contentEditable="false" style="width:98%; height:calc(100% - 90px); font-size:16px;overflow:auto;white-space:nowrap;padding:5px;"></div> <!-- for height:calc(100% - 60px); te60 is the height of the output pane header, This letsthe lower part of outpt pane take up 100% of the hieght of the lower split pane MINUS the outut pane header of 60px.-->
<div id="output_div_id" contentEditable="false" style="width:98%; height:calc(100% - 100px); font-size:16px;overflow:auto;white-space:nowrap;padding:5px;"></div> <!-- for height:calc(100% - 60px); te60 is the height of the output pane header, This letsthe lower part of outpt pane take up 100% of the hieght of the lower split pane MINUS the outut pane header of 60px.-->
<!-- contentEditable="false" means the text can't be edited BUT for chrome apps, this makes the content selectable and now I can copy and paste it whereas previoiusly I couldn't select and copy it. -->
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions instruction.js
Original file line number Diff line number Diff line change
Expand Up @@ -3276,6 +3276,7 @@ Instruction.Control.read_from_robot = class read_from_robot extends Instruction.
if(an_instruction instanceof Instruction.Control.read_from_robot){
read_from_robot_instance = an_instruction
read_from_robot_instance.processing_r_instruction = false
break;
}
}
if(read_from_robot_instance === undefined) {
Expand Down
14 changes: 10 additions & 4 deletions job.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ var Job = class Job{
(this.do_list.length == 0) &&
((this.when_stopped == "wait") || (typeof(this.when_stopped) == "function"))) {} //special case to allow an empty do_list if we are waiting for an instruction or have a callback.
else if (this.do_list.length == 0) {
dde_error("While starting job: " + this.name + " the do_list is empty.")
warning("While starting job: " + this.name + ", the do_list is empty.<br/>" +
"The job still requests the status of Dexter, but does not cause it to move.")
}
else if (this.program_counter >= this.do_list.length){ //note that maybe_symbolic_pc can be "end" which is length of do_list which is valid, though no instructions would be executed in that case so we error.
dde_error("While starting job: " + this.name +
Expand Down Expand Up @@ -927,18 +928,23 @@ Job.prototype.finish_job = function(perform_when_stopped=true){ //regardless of
the_job.set_up_next_do(0)
}
else if (typeof(the_job.when_stopped) === "function"){
setTimeout(function () { the_job.when_stopped.call(the_job) },
setTimeout(function () { the_job.when_stopped.call(the_job)
the_job.finish_job(false)
},
100)
}
else if (Job.is_plausible_when_stopped_value(the_job.when_stopped)){
setTimeout(function(){
const found_job = Job.instruction_location_to_job(the_job.when_stopped, false)
if (found_job) { the_job = found_job }
the_job.start({program_counter: the_job.when_stopped})
the_job.finish_job(false)
setTimout(function(){ //give the first job the chance to finish so that it isn't taking up the socket, and only THEN start the 2nd job.
the_job.start({program_counter: the_job.when_stopped})
}, 200)
}, 100)
}
else {
shouldnt("Job: " + the_job.name + " has an invalid wnen_stopped value of: " + the_job.when_stopped)
shouldnt("Job: " + the_job.name + " has an invalid when_stopped value of: " + the_job.when_stopped)
}
},
1)
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "dexter_dev_env",
"productName": "dexter_dev_env",
"version": "2.5.11",
"release_date": "Nov 11, 2018",
"version": "2.5.12",
"release_date": "Nov 18, 2018",
"description": "Dexter Development Environment",
"author": "Fry",
"license": "GPL-3.0",
Expand Down Expand Up @@ -30,6 +30,7 @@
"jquery": "^3.1.1",
"opencv.js": "^1.2.1",
"pegjs": "^0.10.0",
"pegjs-backtrace": "^0.1.2",
"ping": "^0.2.2",
"request": "^2.79.0",
"rotating-calipers": "0.0.0",
Expand Down
Loading

0 comments on commit 300634d

Please sign in to comment.