Skip to content

Commands

smhty edited this page Dec 19, 2018 · 2 revisions

Introduction

In this section we describe the list of valid commands available for Dorna. Each command is a JSON object with pairs of key and value. The main keys for each command  are "commands", "prm" and "fulfill" (general JSON object format: {"command": _command, "prm": _prm, "fulfill": _fulfill}):

  • "command" (required) - string: The value associated to this key holds the name of the command.
  • "prm" (required) - different formats: The parameters associated to the command.
  • "fulfill" (optional) - true or false: The behavior of the command during error, and the default value is true.

Fulfill

The fulfill key defines the behavior of the command if any error happens. The value assigned to the "fulfill" key can be either true or false, and by default it is set to true:

  • true: If there was any error during this command, ignore the current command and jump to the next commands (ignore error).
  • false: If there was any error during this command, ignore the current and every command after this (pause if there was any error).

Commands and parameters

Next we describe the valid commands and the parameter associated to each one of them.

Command name Description
move Move the robot
wait_for_input Wait for the input pattern
set_io Set the IO

Move

{"command": "move", "prm": }

This command moves the robot to a given point in space. During a move command, the robot moves from an initial point (start point), to the end point. The end point positions can be given either in the joint coordinate system or the Cartesian coordinate system format. For better understanding, fix the coordinate system (joint or Cartesian), and assume that the start position is (a0, a1, a2, a3, a4) (similar calculation applies to the 6-axis robot), and the end position is (b0, b1, b2, b3, b4).

move command has multiple keys in the parameter.

Parameter

  • "path" (required) - string: The two possible values for this key are "joint" or "line":

    • "joint": The robot moves the joints simultaneously and uniformly to get to the end point.
    • "line": The motion is a linear path in the Cartesian space. This means that the tip of the toolhead follows a straight line to travel from the start point to the end point.
  • "movement" (required) - number: The two possible values for this key are 0 or 1:

    • 0: The position of the end point is given in absolute coordinate.
    • 1: The position of the end point is given in relative to the start point.
  • "speed" (optional) - positive number: Sets the speed for the move command. There also few points about the speed:

    • If the "path" parameter  is "joint" then the speed unit is deg/min.
    • If the "path" parameter is "line", then the speed unit is the robot length unit per minutes. (mm/min or inch/min depending on the robot length unit system).
    • If the speed is not given, then the robot always follows the previous speed, unless the current "path" parameter is different than the previous one. In this case the robot pick the default speed according to: If the "path" is "joint" then the robot selects the default joint speed, and if the "path" is "line" then the robot selects the default xyz speed.
  • "jerk" (optional) - array of positive numbers and size 5 or 6: Sets the maximum jerk value for the axes during the move. Jerk is settable independently for each axis to support different dynamics per axis. Few points about the jerk:

    • Notice that the jerk is in unit/min^3, so the numbers tend to be quite large - typically in the many millions or even billions of mm/min^3. So all entries are considered to be in millions. e.g. a value of 500 is actually 500,000,000 mm/min^3.
    • If the "path" parameter is equal to "line", then the jerk vector sets the jerk for the axes x, y, z, a, and b (and c if there are 6 axis), in the Cartesian coordinate system. Moreover, the jerk unit for x, y and z is the robot length unit/min^3 ( inch/min^3 or mm/min^3, depending on the length unit), and  deg/min^3 for a, and b.
    • If the "path" parameter is equal to "joint", then we are setting the jerk for axis j0, j1, j2, j3, and j4 (and j5 if there are 6 axis), and the jerk unit is deg/min^3.
    • Similar to the speed, if the jerk is not given, then the robot always follows the previous jerk, unless the current "path" parameter is different than the previous one. In this case the robot picks the default jerk according to: If the "path" is "joint" then the robot selects the default joint jerk, and if the "path" is "line" then the robot selects the default xyz jerk.
  • The positions can be given either in the joint coordinate system or the Cartesian coordinate system For better understanding, assume that the starting position is (a0, a1, a2, a3, a4) (we can do similar calculation for 6-axis), and the end position is (b0, b1, b2, b3, b4), and the position parameter is (c0, c1, c2, c3, c4).
    If the "movement" parameter is 0 (absolute), then the robot moves until it reaches the end position (b0, b1, b2, b3, b4). If the "movement" parameter is 1 (relative position), then the final position is (b0, b1, b2, b3, b4) = (a0+c0, a1+c1, a2+c2, a3+c3, a4+c4). Also If any of the position parameters c0, c1, c2, c3, or c4 is missing, then the robot will not move in that direction. To set the (c0, c1, c2, c3, c4) we can use one of the following formats:

    • If (c0, c1, c2, c3, c4) is in the joint coordinate system, then we can specify each coordinate with its key. "j0": c0, "j1": c1, "j2": c2, "j3": c3, "j4": c4. Notice that if any of the axes is missing, then the robot will not move in the direction of that axis.
    • If (c0, c1, c2, c3, c4) is in the joint coordinate system, then we can use the key "joint" to set the position, "joint": [c0, c1, c2, c3, c4].
    • If (c0, c1, c2, c3, c4) is in the Cartesian coordinate system, then we can specify each coordinate with its key. "x": c0, "y": c1, "z": c2, "a": c3, "b": c4. Notice that if any of the axes is missing, then the robot will not move in the direction of that axis.
    • If (c0, c1, c2, c3, c4) is in the Cartesian coordinate system, then we can use the key "xyz" to set the position, "xyz": [c0, c1, c2, c3, c4].

Summary

Key Value Note
"path" "joint" or "line" Required
"movement" 0 = absolute or 1 = relative Required
"speed" speed_value Optional
"jerk" jerk_array Optional
Position of the end point Specify the position of the end point, and this can be done in various formats Required

path_joint
Fig. 1: Path equal to joint.

path_joint
Fig. 2: Path equal to line.

Wait for Input

{"command": "wait_for_input", "prm": }

This command stops the program and waits for the inputs to match the input pattern. If the pattern appeared then the program proceeds.
Notice that this command only takes one input as a parameter.

Parameter

This command takes only one of the inputs: "in1", "in2", "in3" and "in4". The value assigned to the key is either 0 or 1. If the assigned value is 0, then the robot waits for the associated input to be 0 and then continuous. If the assigned value is 1, then the robot waits for the associated input to be 1 and then continuous.

Example

# Stops the program until input 1 is off (0), and then proceeds
{"command": "wait_for_input", "prm": {"in1": 0}}

# Stops the program until input 4 is on (1), and then proceeds 
{"command": "wait_for_input", "prm": {"in4": 1}}

Set IO

{"command": "set_io", "prm": }

This command is able to set outputs, mode of inputs and outputs, laser and servo:

  • Set the value of any one of the outputs 1 to 4 to either 0 (off) or 1 (on).
  • Set the mode of any one of the outputs 1 to 4, and inputs 1 to 4 to either 0 (active low) or 1 (active high).
  • Turn the laser 0 (off) or 1 (off).
  • Set the value of the servo motor from 0 (all open) to 1000 (fully closed).

Parameter

The parameter can include multiple pairs of key and value according to the following table:

Key Value Note
"outN" 0 (off) or 1 (on) Set the value for the output N, for N from 1 to 4
"doNmo" 0 (active low) or 1 (active high) Set the mode for the output N, for N from 1 to 4
"diNmo" 0 (active low) or 1 (active high) Set the mode for the input N, for N from 1 to 4
"laser" 0 (off) or 1 (on) Turn the laser on or off
"servo" Any number from 0 (all open) to 1000 (all closed) Set the servo

Example

# Set the input 1 mode to active low, output 1 value to 1, turn on the laser, and set the servo to 500   
{"command": "set_io", "prm": {"in1mo": 0, "out1": 1, "laser": 1, "servo": 500}}

Sleep

{"command": "sleep", "prm": }

This command suspends execution for the given number of seconds. The number of seconds is the value assigned to the "prm" key.

Example

# sleep of 1.01 seconds  
{"command": "sleep", "prm": 1.01}
You can’t perform that action at this time.