Fanuc SDK documentation
Motion commands
Send linear, joint, and circular motion commands with configurable speed, termination type, and acceleration via RMI.
RMI lets you send TP-equivalent motion instructions to the robot. Each instruction has a unique sequenceId and is queued for execution in order.
Linear motion
Move the robot in a straight line to a Cartesian target:
Frame target = new Frame { X = 500, Y = 200, Z = 300, W = 0, P = 90, R = 0 };MotionConfiguration config = new MotionConfiguration { UToolNumber = 1, UFrameNumber = 0 };robot.Rmi.LinearMotion(sequenceId: 1,config: config,position: target,speedType: SpeedType.MmSec,speed: 100,termType: TerminationType.Fine,termValue: 0,acc: null, offsetPr: null, visionPr: null, wristJoint: false, mrot: false,lcbType: null, lcbValue: null, portType: null, portNumber: null, portValue: null);
Speed types
SpeedType | Description |
|---|---|
MmSec | Millimeters per second |
InchMin | Inches per minute |
Time | Time in seconds |
Percent | Percentage of maximum speed |
Termination types
TerminationType | Description |
|---|---|
Fine | Stop precisely at the target |
Cnt | Continuous (fly-by, value = CNT percentage) |
Cr | Corner Region |
Joint motion
Move using joint interpolation:
Frame target = new Frame { X = 500, Y = 200, Z = 300, W = 0, P = 90, R = 0 };MotionConfiguration config = new MotionConfiguration { UToolNumber = 1, UFrameNumber = 0 };// Joint motion with Cartesian targetrobot.Rmi.JointMotion(sequenceId: 2,config: config,position: target,speedType: SpeedType.Percent,speed: 50,termType: TerminationType.Cnt,termValue: 100,acc: null, offsetPr: null, visionPr: null, mrot: false,lcbType: null, lcbValue: null, portType: null, portNumber: null, portValue: null);// Joint motion with joint anglesJointAngles joints = new JointAngles { J1 = 0, J2 = 0, J3 = 0, J4 = 0, J5 = -90, J6 = 0 };robot.Rmi.JointMotionJRep(sequenceId: 3,joints: joints,speedType: SpeedType.Percent,speed: 50,termType: TerminationType.Cnt,termValue: 100,acc: null, offsetPr: null, visionPr: null, mrot: false,lcbType: null, lcbValue: null, portType: null, portNumber: null, portValue: null);
Joint motion with joint representation
Specify joint angles directly instead of a Cartesian frame.
Circular motion
Circular motion requires a via point and a destination:
MotionConfiguration config = new MotionConfiguration { UToolNumber = 1, UFrameNumber = 0 };Frame via = new Frame { X = 450, Y = 250, Z = 350, W = 0, P = 90, R = 0 };MotionConfiguration viaConfig = new MotionConfiguration { UToolNumber = 1, UFrameNumber = 0 };Frame dest = new Frame { X = 500, Y = 300, Z = 300, W = 0, P = 90, R = 0 };robot.Rmi.CircularMotion(sequenceId: 4,config: config,position: dest,viaConfig: viaConfig,viaPosition: via,speedType: SpeedType.MmSec,speed: 50,termType: TerminationType.Fine,termValue: 0,acc: null, offsetPr: null, visionPr: null, wristJoint: false, mrot: false,lcbType: null, lcbValue: null, portType: null, portNumber: null, portValue: null);
Relative motions
All motion types have relative (incremental) variants.
Wait and instruction packets
Insert wait conditions between motions:
// Wait for digital input DI[5] = ONrobot.Rmi.WaitDin(sequenceId: 10, portNumber: 5, value: OnOff.ON);// Wait for a duration (seconds)robot.Rmi.WaitTime(sequenceId: 11, seconds: 2.0);// Set frame/tool mid-programrobot.Rmi.SetUFrameInstruction(sequenceId: 12, frameNumber: 2);robot.Rmi.SetUToolInstruction(sequenceId: 13, toolNumber: 3);// Set payload schedulerobot.Rmi.SetPayload(sequenceId: 14, scheduleNumber: 1);
Complete example
using UnderAutomation.Fanuc;using UnderAutomation.Fanuc.Rmi.Data;public class RmiMotion{public static void Main(){FanucRobot robot = new FanucRobot();ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");parameters.Rmi.Enable = true;robot.Connect(parameters);robot.Rmi.Initialize();/**/Frame target = new Frame { X = 500, Y = 200, Z = 300, W = 0, P = 90, R = 0 };MotionConfiguration config = new MotionConfiguration { UToolNumber = 1, UFrameNumber = 0 };// Linear motionrobot.Rmi.LinearMotion(sequenceId: 1,config: config,position: target,speedType: SpeedType.MmSec,speed: 100,termType: TerminationType.Fine,termValue: 0,acc: null, offsetPr: null, visionPr: null, wristJoint: false, mrot: false,lcbType: null, lcbValue: null, portType: null, portNumber: null, portValue: null);// Joint motionrobot.Rmi.JointMotion(sequenceId: 2,config: config,position: target,speedType: SpeedType.Percent,speed: 50,termType: TerminationType.Cnt,termValue: 100,acc: null, offsetPr: null, visionPr: null, mrot: false,lcbType: null, lcbValue: null, portType: null, portNumber: null, portValue: null);// Joint motion with joint anglesJointAngles joints = new JointAngles { J1 = 0, J2 = 0, J3 = 0, J4 = 0, J5 = -90, J6 = 0 };robot.Rmi.JointMotionJRep(sequenceId: 3,joints: joints,speedType: SpeedType.Percent,speed: 50,termType: TerminationType.Cnt,termValue: 100,acc: null, offsetPr: null, visionPr: null, mrot: false,lcbType: null, lcbValue: null, portType: null, portNumber: null, portValue: null);// Circular motion (via point + destination)Frame via = new Frame { X = 450, Y = 250, Z = 350, W = 0, P = 90, R = 0 };MotionConfiguration viaConfig = new MotionConfiguration { UToolNumber = 1, UFrameNumber = 0 };robot.Rmi.CircularMotion(sequenceId: 4,config: config,position: target,viaConfig: viaConfig,viaPosition: via,speedType: SpeedType.MmSec,speed: 50,termType: TerminationType.Fine,termValue: 0,acc: null, offsetPr: null, visionPr: null, wristJoint: false, mrot: false,lcbType: null, lcbValue: null, portType: null, portNumber: null, portValue: null);// Wait for digital inputrobot.Rmi.WaitDin(sequenceId: 10, portNumber: 5, value: OnOff.ON);// Wait for a durationrobot.Rmi.WaitTime(sequenceId: 11, seconds: 2.0);// Set payload schedulerobot.Rmi.SetPayload(sequenceId: 12, scheduleNumber: 1);/**/}}
API reference
Members of Rmi.Data.Frame :public class Frame {public Frame()public override bool Equals(object obj)// Extended axis 1 (optional).public double Ext1 { get; set; }// Extended axis 2 (optional).public double Ext2 { get; set; }// Extended axis 3 (optional).public double Ext3 { get; set; }public override int GetHashCode()// P (Pitch) in degrees.public double P { get; set; }// R (Roll) in degrees.public double R { get; set; }public override string ToString()// W (Yaw) in degrees.public double W { get; set; }// X coordinate in millimeters.public double X { get; set; }// Y coordinate in millimeters.public double Y { get; set; }// Z coordinate in millimeters.public double Z { get; set; }}
public class MotionConfiguration {public MotionConfiguration()public override bool Equals(object obj)// FLIP bit (0/1).public byte Flip { get; set; }// FRONT bit (0/1).public byte Front { get; set; }public override int GetHashCode()// LEFT bit (0/1).public byte Left { get; set; }public override string ToString()// Turn 4.public byte Turn4 { get; set; }// Turn 5.public byte Turn5 { get; set; }// Turn 6.public byte Turn6 { get; set; }// Active UFRAME number.public byte UFrameNumber { get; set; }// Active UTOOL number.public byte UToolNumber { get; set; }// UP bit (0/1).public byte Up { get; set; }}
public class JointAngles {public JointAngles()public override bool Equals(object obj)public override int GetHashCode()// Joint 1 angle.public double J1 { get; set; }// Joint 2 angle.public double J2 { get; set; }// Joint 3 angle.public double J3 { get; set; }// Joint 4 angle.public double J4 { get; set; }// Joint 5 angle.public double J5 { get; set; }// Joint 6 angle.public double J6 { get; set; }// Joint 7 angle (optional extended axis).public double J7 { get; set; }// Joint 8 angle (optional extended axis).public double J8 { get; set; }// Joint 9 angle (optional extended axis).public double J9 { get; set; }public override string ToString()}
public enum SpeedType {// Linear speed in inches per minute.InchMin = 1// Linear speed in millimeters per second.MmSec = 0// Joint speed as percentage of maximum.Percent = 3// Duration-based speed (0.1 seconds unit for Linear/Circular, milliseconds for Joint).Time = 2}
public enum TerminationType {// Continuous termination; blend motions (1-100).Cnt = 1// Constant path mode (requires option).Cr = 2// FINE termination; precise stop.Fine = 0}
public class RmiSequenceResponse : RmiResponseBase {public RmiSequenceResponse()public override bool Equals(object obj)public override int GetHashCode()// Echoed SequenceID of the instruction that completed.public int SequenceId { get; set; }public override string ToString()}