Move robot remotely
Move a Fanuc robot from an external application using RMI motion commands, Stream Motion real-time streaming, or DPM with SNPX.
Move a Fanuc robot remotely using the SDK. There are several approaches depending on your application requirements.
RMI : TP-like motion commands
RMI (Remote Motion Interface) sends motion instructions similar to a TP program. Best for pick-and-place, welding paths, and multi-waypoint trajectories.
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);/**/}}
Requirements: J992 (Remote Motion Interface) robot option.
See also: RMI Motion commands
Stream Motion : Real-time streaming (J519)
Stream Motion sends joint or Cartesian positions at up to 250 Hz via UDP. Best for real-time control, force feedback, and adaptive paths.
// Connect and start streamingvar parameters = new ConnectionParameters("192.168.0.1");parameters.StreamMotion.Enable = true;robot.Connect(parameters);robot.StreamMotion.Start();// Send a joint commandrobot.StreamMotion.SendJointCommand(new MotionData{J1 = 0,J2 = -30,J3 = 45,J4 = 0,J5 = 60,J6 = 0});// React to state updates (~125–250 Hz)robot.StreamMotion.StateReceived += (s, e) =>{StatePacket state = e.State;// state.JointPosition, state.CartesianPosition, state.Status...};
Requirements: J519 (Stream Motion) robot option.
See also: Stream Motion
SNPX + DPM : Position register handshake
See : Move Robot with Mouse
FTP
If you have option ASCII Upload, you can build th TP program .ls file, download it via FTP and execute the task with Telnet, SNPX. or CGTP
See : TP editor with breakpoints
CGTP
CGTP allows you to create a new program, insert instructions, and execute it.