05-11-2020, 08:14 PM
I am using C# but don't mind python solutions. In the RoboDK API, is it possible to run one instruction at a time within a robot problem (such as one created from a point follow project)? The purpose is to synchronize the movements of multiple robotic arms from a robot program generated from two point follow projects. The code looks something like this:
Code:
// Assume this running as a separate thread
void WorkRobots(string robotName)
{
// Create new reference to RDK for the thread
RoboDK _RDK = new RoboDK();
// Get the program "Point"
RoboDK.Item prog = RDK.getItem("Point");
// Get the robot used for the program, set the program to run on this robot
RoboDK.Item robot = _RDK.getItem(robotName);
prog.setRobot(robot);
// Loop through all instructions in the program
for (int ins_id = 0; ins_id < prog.InstructionCount(); ins_id++)
{
// Get the instruction
string insName;
int insType, moveType;
bool isJointTarget;
Mat pose;
double[] joints;
prog.Instruction(ins_id,
out insName,
out insType,
out moveType,
out isJointTarget,
out pose,
out joints);
// Run one instruction
prog.RunInstruction(ins_id, ???); // ??????? What to do here ????????
// Await the other threads to finish before next instruction
SyncWait();
} // end for loop
} // end function