Hi, I need real time data of torque from joint sensor when robot is moving and then transfer the data to PC to analyse. But I have no idea how to get the data. The method of datarecorder is not suitable for this condition because the log file can be got only after motion.
Could anybody has some advice? thank you very much.
How to get Jointsensor data during motion in real time?
-
stone_3rd -
May 23, 2018 at 12:05 AM -
Thread is marked as Resolved.
-
-
[size=2]did you try
lbr.getMeasuredTorque()[/size]
-
[size=2px]did you try [/size][size=2px]lbr.getMeasuredTorque()[/size]
Yes,I've try it ,like this:
lbr_iiwa_14_R820_1.move(lin(getApplicationData().getFrame("/PullP2")).setCartVelocity(150).setMode(cartImpCtrlMode));
TorqueSensorData measuredData = lbr_iiwa_14_R820_1.getMeasuredTorque();and it does work.
But this torques are measured when the move stopped.What I don't know is that how to get the torques when robot is moving.
-
you are using wrong motion command. MOVE is a synchronous command which means instruction pointer stays with this command until move is complete, then it measures torque...
-
Thank you very much, I have not noticed that,and will try it.
-
try moveAsync
-
You can use a background Task. I just answered a thread, where someone wanted to get the robot position in real-time.
Here's a modifying version of it that gets you what you want.
You need a client that receives that data, though.Java
Display Morepackage backgroundTask; import java.net.*; import java.io.IOException; import java.util.concurrent.TimeUnit; import com.kuka.roboticsAPI.deviceModel.LBR; import com.kuka.roboticsAPI.controllerModel.Controller; import com.kuka.roboticsAPI.sensorModel.TorqueSensorData; import com.kuka.roboticsAPI.applicationModel.tasks.CycleBehavior; import com.kuka.roboticsAPI.applicationModel.tasks.RoboticsAPICyclicBackgroundTask; public class BkgPositionSender extends RoboticsAPICyclicBackgroundTask { private Controller controller; private LBR robot; byte[] posArr; int port = 30005; InetAddress IP = null; DatagramSocket datagramSocket = null; DatagramPacket packet; public void initialize() { controller = (Controller) getContext().getControllers().toArray()[0]; robot = (LBR) controller.getDevices().toArray()[0]; initializeCyclic(5000, 500, TimeUnit.MILLISECONDS,CycleBehavior.BestEffort); try { datagramSocket = new DatagramSocket(); IP = InetAddress.getByName("172.31.1.135"); // get PC's address } catch (SocketException e) { e.printStackTrace(); } catch (UnknownHostException e) { e.printStackTrace(); } } public void runCyclic() { TorqueSensorData measuredData = robot.getMeasuredTorque(); posArr = measuredData.toString().getBytes(); packet = new DatagramPacket(posArr, posArr.length, IP, port); try { datagramSocket.send(packet); } catch (IOException e) { e.printStackTrace(); } } }
The client will receive this :
-
Take a look at DataRecorder objects to poll the sensors and save the data.
-
Take a look at DataRecorder objects to poll the sensors and save the data.
He said:The method of datarecorder is not suitable for this condition because the log file can be got only after motion.
==> This does not work if he wants to analyse the data in "real time". -
Hello,
you might try the Sunrise.FRI option,Just use it in "Monitor mode"...
With FRI, you can open an FRI Channel, (effectively a UDP socket),
where this data is provided in a configurable equidistant realtime datastream.
You can choose the datarate between 1...100msec on opening the channel.DrG