Instruction Executor example
This example shows how to use the Instruction Executor class. It can be used for easily executing a sequence of instructions such as motions on the robot using the built-in URScript functions.
The instruction_executor.cpp shows how to use this class:
Note
For the instruciton executor to work there has to be an established connection to the ReverseInterface. That means, the respective program has to be running on the robot. The example below will do that automatically, if the connected robot is in remote_control mode.
At first, a InstructionExecutor
object is created with the URDriver object as it needs that
for communication with the robot.
Currently, the InstructionExecutor
can either be used to run sequences of motions or single motions.
Execute a sequence of motions
To run a sequence of motions, create an
std::vector<std::shared_ptr<urcl::cointrol::MotionPrimitive>>
and pass it to the
executeMotion
function:
Each element in the motion sequence can be a different motion type. In the example, there are two
MoveJ
motions and two MoveL
motion. The primitives’ parameters are directly forwarded to
the underlying script functions, so the parameter descriptions for them apply, as well.
Particularly, you may want to choose between either a time-based execution speed or an acceleration
/ velocity parametrization. The latter will be ignored if a time > 0 is given.
Execute a single motion
To run a single motion, the InstructionExecutor
provides the methods moveJ(...)
and
moveL(...)
:
Again, time parametrization has priority over acceleration / velocity parameters.