Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
cfry committed May 1, 2017
1 parent c47a585 commit d27e772
Show file tree
Hide file tree
Showing 12 changed files with 1,340 additions and 1,067 deletions.
1,077 changes: 168 additions & 909 deletions doc/dde_overview/Dexter_Development_Environment.html

Large diffs are not rendered by default.

1,002 changes: 1,002 additions & 0 deletions doc/dde_overview/Dexter_Development_Environment_old.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions doc/guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</style>
<details class="doc_details"><summary>About</summary>
This is <a href="http://hdrobotic.com/" target="_blank">Dexter</a> Development Environment<br/>
version: <span id="dde_version_id">1.1.4</span><br/>
released: <span id="dde_release_date_id">Apr 23, 2017</span>
version: <span id="dde_version_id">1.1.5</span><br/>
released: <span id="dde_release_date_id">Apr 30, 2017</span>
<p/>
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,
Expand Down
98 changes: 77 additions & 21 deletions doc/ref_man.html
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,39 @@
only have to define it once.
</details>

<details class="doc_details"><summary>Any JS Code</summary>
If you have some JavaScript code that you want to go between 2
other instructions on a Job's do_list, your first inclination
might be to just stick it on the do_list like so
<pre>
do_list: [Robot.out("hi"),
my_fn(12, 34),
Robot.out("bye")
]
</pre>
What happens here is that when the <i>definition</i> of the job is evaled,
the function my_fn will be called with args 12 and 34.
Whatever that function returns will be put on the do list
between the other 2 instuctions.
So if my_fn <i>returns</i> an instruction to run, and the making of that instruction
does not depend on anything that happens while running the instructions of the job,
then you're all set.
<br/>
<b>BUT</b> if what you want is for the eval of <code>my_fn(12, 34)</code>
to occur after the instruction returned by <code>Robot.out("hi")</code> is run,
then you'll want to wrap your code in a function, and put the definition
of that wrapper function on the do_list like so:<br/>
<code>function(){ my_fn(12, 34) }</code><br/>
In the body of the above function, <code>this</code> will be bound
to the instance of the running job.
Note that if calling my_fn returns an instruction (or an array of instructions)
that you want to run in the job, then our code for this do_list item should
look like:
<code>function(){ return my_fn(12, 34) }</code>
<p/>
If you are confused about what a given instruction on a Job's do_list
returns, just select it in the editor and EVAL it.
</details>

<details id="Robot.error_doc_id" class="doc_details"><summary>error</summary>
Causes the job to error, immediately stopping it.
Expand Down Expand Up @@ -788,14 +821,30 @@
robot_status is an array that holds data from the robot, along with aspects of the instruction
that was sent to the robot to capture that data. This array is the value of the robot
instance field <code>robot_status</code>. <p/>
<code>grab_robot_status</code> provides an easy way to get values out of that array.
<code>grab_robot_status</code> provides an easy way to get values out of that array
and made available for other instructions to use.<br/>
<i>Parameters</i><br/>
<b>user_data_variable</b> A string (required) of the name of the job's
<code>user_data</code> variable to shove the grabbed
robot_status data into.<br/>
robot_status data into. If their is already such a variable,
its value is over-written. If not, it is created and intialized
with the new value.
<p/>
After this instruction is run, the grabbed value
is available globally Job.the_job_name.user_data_var_name.<br/>
For instance, if this job is named "my_job" and the value of
user_data_variable is "my_var" then:
<code>Job.my_job.my_var</code>
But inside another instruction that is defined as a function,
<code>this</code> will be bound to the current job instance so:
<code>this.user_data.my_var</code> will access the grabbed data.

<b>start_index</b> A non-negative integer signifying the
first data item to extract from the robot_status array.
Its default value is the value of <code>Serial.DATA0</code><br/>
Its default value is the value of <code>Serial.DATA0</code>
Another normal value would be <code>Dexter.J1_ANGLE</code>
See below for a comprehensive list.
<br/>
<i>Special values:</i> <code>"all"</code> The entire 60 element robot_status
array is used. The value of end_index is ignored.<br/>
<code>"data_array"</code> The part of the robot_status array after
Expand All @@ -806,7 +855,8 @@
<b>end_index</b> A non-negative integer signifying the last element of the
robot_status array to extract. The default value is <code>null</code>.
If this value is null or not passed, only the data at the start_index
is used. The value will NOT be an array, just that one element.<br/>
is used. The value stored in teh user_data variable will NOT be an array,
just that one element.<br/>
<i>Special value</i> <code>"end"</code> The portion of the robot_status
from start_index through the end of the robot_status array is extracted.
<p/>
Expand All @@ -823,21 +873,21 @@
Dexter.STOP_TIME"
Dexter.INSTRUCTION_TYPE //a letter signifying the instruction type.

Dexter.ERROR_CODE" //0 means no error.
Dexter.DMA_READ_DATA"
Dexter.READ_BLOCK_COUNT"
Dexter.RECORD_BLOCK_SIZE"
Dexter.END_EFFECTOR_IN"

Dexter.J1_ANGLE" // BASE_POSITION_AT
Dexter.J1_DELTA" // BASE_POSITION_DELTA
Dexter.J1_PID_DELTA" // BASE_POSITION_PID_DELTA
Dexter.J1_FORCE_CALC_ANGLE" // BASE_POSITION_FORCE_DELTA
Dexter.J1_A2D_SIN", // BASE_SIN
Dexter.J1_A2D_COS", // BASE_COS
Dexter.J1_PLAYBACK", // PLAYBACK_BASE_POSITION
Dexter.J1_SENT", // SENT_BASE_POSITION
Dexter.J1_SLOPE", // SLOPE_BASE_POSITION
Dexter.ERROR_CODE //0 means no error.
Dexter.DMA_READ_DATA
Dexter.READ_BLOCK_COUNT
Dexter.RECORD_BLOCK_SIZE
Dexter.END_EFFECTOR_IN

Dexter.J1_ANGLE // BASE_POSITION_AT
Dexter.J1_DELTA // BASE_POSITION_DELTA
Dexter.J1_PID_DELTA // BASE_POSITION_PID_DELTA
Dexter.J1_FORCE_CALC_ANGLE // BASE_POSITION_FORCE_DELTA
Dexter.J1_A2D_SIN, // BASE_SIN
Dexter.J1_A2D_COS, // BASE_COS
Dexter.J1_PLAYBACK, // PLAYBACK_BASE_POSITION
Dexter.J1_SENT, // SENT_BASE_POSITION
Dexter.J1_SLOPE, // SLOPE_BASE_POSITION
</pre>
and a similar set of names beginning with J2, J3, J4 and J5.
<p/>
Expand All @@ -864,10 +914,10 @@
In order to insure that the Dexter robot_status array is up to date,
you should place <code>Dexter.get_robot_status()</code> in your do_list before
the grab_robot_status instruction.<br/>
<i>Example:</i><br/>
<i>Examples of 2 adjacent instructions on a job's do_list:</i><br/>
<code>
Dexter.get_robot_status(),
Robot.grab_robot_status("no_result", Serial.DATA0), </code><br/>
Robot.grab_robot_status("my_zero_data", Serial.DATA0) </code><br/>
See Job Example 9 for an extended example.
</details> <!-- end grab_robot_status -->

Expand Down Expand Up @@ -1258,8 +1308,14 @@
the job's <code>robot_status</code> field, and, if the job's <code>keep_history</code> is true, gets pushed onto the
job's <code>rs_history</code> array.
<p/>
<i>Examples</i>:
<code>Dexter.get_robot_status() //how this should look on job's do list.</code><br/>
<code>Jobs.j1.robot_status //getting the whole status array after the above instruction is run</code><br/>
<code>Jobs.j1.robot_status[Dexter.J1_ANGLE] //returns the angle of Joint 1, in arcseconds</code><p/>
This instruction blocks further processing of the job's do_list instructions until
all of the instructions on Dexter's instruction_queue are executed.
<p/>
See also the instruction: <code>Robot.grab_robot_status</code>
</details>

<details id="Dexter.get_robot_status_immediately_doc_id" class="doc_details"><summary>get_robot_status_immediately</summary>
Expand Down
24 changes: 24 additions & 0 deletions doc/release_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,30 @@
}
.doc_details summary { font-weight: 600; }
</style>
<details class="doc_details"><summary>v 1.1.5, Apr 30, 2017</summary>
Highlights: Fixed bug in load_files, improved doc and DDE launch print outs.
<ul><li>overview paper
<ul><li>Minor editing improvements</li>
<li>Simplified the embedded HTML</li>
<li>Made img urls work for both DDE and website.</li>
</ul></li>
<li> Dexter.get_robot_status Ref Man entry extended with examples.</li>

<li> Updated Robot.grab_user_status examples.</li>

<li> New doc section: Ref Man/Robots/Robot Instructions/Any JS Code/</li>

<li> When DDE launches, now printed in the output pane:
<pre>
Now Loading /Users/Fry/Documents/dde_apps/dde_init.js
Done Loading /Users/Fry/Documents/dde_apps/dde_init.js</pre></li>

<li> Fix to load_files when loading paths not starting with slash.
Fixes a problem with loading dde_init.js</li>

<li> Better printouts and initialization when loading dde_persistent.json</li>
</ul>
</details>

<details class="doc_details"><summary>v 1.1.2, Apr 22, 2017</summary>
<ul><li> New Insert menu item "Color".</li>
Expand Down
108 changes: 0 additions & 108 deletions getusermedia.js

This file was deleted.

16 changes: 15 additions & 1 deletion job.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var esprima = require('esprima')

var Job = class Job{
constructor({name=null, robot=Dexter.dexter0, do_list=[], keep_history=true, show_instructions=false,
constructor({name=null, robot=Robot.dexter0, do_list=[], keep_history=true, show_instructions=false,
inter_do_item_dur = 100, user_data={}, program_counter=0, ending_program_counter="end",
initial_instruction = null} = {}){
//program_cpunter is the counter of the next instruction that should be executed.
Expand All @@ -24,6 +24,20 @@ var Job = class Job{
Job.job_id_base += 1
this.job_id = Job.job_id_base
if (this.name == null){ this.name = "job_" + this.job_id }
if (!(robot instanceof Robot)){
if (!Robot.dexter0){
dde_error("Attempt to created Job: " + this.name + " with no valid robot instance.<br/>" +
" Note that Robot.dexter0 is not defined<br/> " +
" but should be in your file: Documents/dde_apps/dde_init.js <br/>" +
" after setting the default ip_address and port.<br/> " +
"To generate the default dde_init.js file,<br/>" +
" rename your existing one and relaunch DDE.")
}
else {
dde_error("Attempt to created Job: " + this.name + " with no valid robot instance.<br/>" +
"You can let the robot param to new Job default to get a correct Robot.dexter.0")
}
}
Job[this.name] = this //beware: if we create this job twice, the 2nd version will be bound to the name, not the first.
Job.remember_job_name(this.name)
this.status_code = "not_started" //see Job.status_codes for the legal values
Expand Down
4 changes: 2 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": "1.1.4",
"release_date": "Apr 23, 2017",
"version": "1.1.5",
"release_date": "Apr 30, 2017",
"description": "Dexter Development Environment",
"author": "Fry",
"license": "GPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ foo //eval to see the latest values</pre>`,
})

//setTimeout(init_view_eye(), 1000) //todo now this file is loaded in sandbox.html. once I get rid of that and solve reuire issues, and on-ready for render process issues, revisit this.
persistent_initialize()
persistent_initialize() //called before loading dde_init.js by design.

const val = persistent_get("save_on_eval")
if(val) { //have to do this because, unlike the DOM doc, chrome/electron checks the box if you set it to false.
Expand Down
Loading

0 comments on commit d27e772

Please sign in to comment.