3 import static com.kuka.roboticsAPI.motionModel.BasicMotions.ptp;
5 import java.nio.ByteBuffer;
9 import com.kuka.connectivity.fastRobotInterface.FRIConfiguration;
10 import com.kuka.connectivity.fastRobotInterface.FRISession;
11 import com.kuka.connectivity.motionModel.smartServo.ISmartServoRuntime;
12 import com.kuka.connectivity.motionModel.smartServo.SmartServo;
13 import com.kuka.connectivity.userInterface.smartServo.ServoMotionUtilities;
14 import com.kuka.roboticsAPI.applicationModel.RoboticsAPIApplication;
15 import com.kuka.roboticsAPI.controllerModel.Controller;
16 import com.kuka.roboticsAPI.deviceModel.JointPosition;
17 import com.kuka.roboticsAPI.deviceModel.LBR;
18 import com.kuka.roboticsAPI.geometricModel.PhysicalObject;
27 private Controller _lbrController;
29 private String _hostName;
30 private String _controllingLaptopIPAddress;
31 private PhysicalObject _toolAttachedToLBR;
32 private ISmartServoRuntime theSmartServoRuntime = null;
37 _lbrController = (Controller) getContext().getControllers().toArray()[0];
38 _lbr = (LBR) _lbrController.getDevices().toArray()[0];
42 _hostName =
"192.170.10.100";
46 _controllingLaptopIPAddress =
"tcp://172.31.1.100:30010";
50 double[] translationOfTool =
53 double[] centerOfMassInMillimeter =
55 _toolAttachedToLBR = ServoMotionUtilities.createTool(_lbr,
56 "SimpleJointMotionSampleTool", translationOfTool, mass,
57 centerOfMassInMillimeter);
64 FRIConfiguration friConfiguration = FRIConfiguration.createRemoteConfiguration(_lbr, _hostName);
65 friConfiguration.setSendPeriodMilliSec(4);
66 FRISession friSession =
new FRISession(friConfiguration);
70 _toolAttachedToLBR.move(ptp(Math.toRadians(10), Math.toRadians(10), Math.toRadians(10), Math.toRadians(-90), Math.toRadians(10), Math.toRadians(10),Math.toRadians(10)));
74 ZMQ.Context context = ZMQ.context(1);
75 ZMQ.Socket subscriber = context.socket(ZMQ.DEALER);
76 subscriber.connect(_controllingLaptopIPAddress);
77 subscriber.setRcvHWM(1000000);
81 JointPosition initialPosition =
new JointPosition(
82 _lbr.getCurrentJointPosition());
83 SmartServo aSmartServoMotion =
new SmartServo(initialPosition);
86 aSmartServoMotion.setJointAccelerationRel(0.2);
87 aSmartServoMotion.setJointVelocityRel(0.2);
89 aSmartServoMotion.setMinimumTrajectoryExecutionTime(20e-3);
91 _toolAttachedToLBR.getDefaultMotionFrame().moveAsync(aSmartServoMotion);
94 theSmartServoRuntime = aSmartServoMotion.getRuntime();
97 JointPosition destination =
new JointPosition(
98 _lbr.getJointCount());
101 byte [] data = subscriber.recv();
102 ByteBuffer bb = ByteBuffer.wrap(data);
117 for (
int i=0; i<100000; i++) {
119 data = subscriber.recv();
120 bb = ByteBuffer.wrap(data);
124 for (
int k = 0; k < destination.getAxisCount(); ++k)
126 destination.set(k, jointState.
position(k));
129 theSmartServoRuntime.setDestination(destination);
151 public static void main(
final String[] args)
154 app.runApplication();
static void main(final String[] args)
static JointState getRootAsJointState(ByteBuffer _bb)