My school has a KUKA LBR IIWA R820. We want to use Sunrise workbench to write some simple program. But there is a trouble that really confused us. We want to use the force condition command to write a conditional loop. But the normal force condition of X, Y, Z has to be >=0. But we want to make the arm reacts when the normal force of X is negative or in the direction of -X. So what should I do? Can someone help me? Thanks first!
This is the code:
ForceCondition normalForce_x = ForceCondition.
createNormalForceCondition(
nase.getFrame("/TCP"),
CoordinateAxis.X,
40.0,
8.0);
IIWA R820 Sunrise workbench how to write negative normal force condition code
-
Alanmin -
March 10, 2017 at 5:32 PM -
Thread is Resolved
-
-
Use a correction frame which axes point opposite to TCP's?
-
But we want to make the arm reacts when the normal force of X is negative or in the direction of -X.
You cannot. Here's from the JavaDoc.QuotecreateNormalForceCondition
public static ForceCondition createNormalForceCondition(AbstractFrame measureFrame,
CoordinateAxis direction,
double threshold,
double tolerance)
Creates a new ForceCondition that checks the magnitude of the measured force in direction of the specified Cartesian coordinate axis (direction).
Use this method if a tolerance other than the default value (= 10) is required.Parameters:
measureFrame - The frame where the measurement will take place. This frame must be statically attached to a device which can measure forces (such as an LBR).
If measureFrame is set to null, the frame that is currently moved is used.
direction - The Cartesian coordinate axis onto which the measured force vector is projected.
threshold - The force threshold value in [N]. The value has to be nonnegative.
tolerance - Tolerance is used as an estimator for maximum allowed measurement inaccuracy. The quality of the measurement depends on the current robot pose, and declines near singularities.
The force condition is fulfilled every time the measurement inaccuracy is equal or greater than the specified tolerance.
Only positive values should be used. A common value is 10.
Returns:
the new ForceConditionFor a loop condition, I would rather use getExternalForceTorque() . Conditions are more useful when you attach them to a listener, hence triggering a process or an action to an event that you cannot predict its occurrence.
-
Use a correction frame which axes point opposite to TCP's?Seems a good idea! Even though, I don't know why OP is opting for a condition for a loop.
-
Thank you kiiwa! I just want the KUKA arm can react differently with different force direction. And I cannot find the Externaltorqueforce.condition in the manual. I just begin to learn the Sunrise, So could you give me an example to show me how to use it. Thank you very much!
-
Use a correction frame which axes point opposite to TCP's?
Thanks for replying, could you please show me how to set the frame. I am fresher of it. Some example program may be very helpful! -
Well, I'm yet to code for IIWA myself, but looking at the code you pasted, the javadoc KIIWA pasted, and the manuals I have, just change the frame parameter of the createNormalForceCondition().
So maybe something like this:
AbstractFrame TCP = nase.getFrame("/TCP");
AbstractFrame NewFrame = Tranformation.ofDeg(0,0,0,180,0,0), TCP);ForceCondition normalForce_x = ForceCondition.createNormalForceCondition(
NewFrame,
CoordinateAxis.X,
40.0,
8.0);OR you could just define a new frame to the sunrise project, and use that in the function call instead.
-
Looking for some help to get my 7th axis slide to move in a program with my tcp. Any examples someone can share for setting up coordinated motion in a program
-
Thank you kiiwa! I just want the KUKA arm can react differently with different force direction. And I cannot find the Externaltorqueforce.condition in the manual. I just begin to learn the Sunrise, So could you give me an example to show me how to use it. Thank you very much!You're welcome!
It's not Externaltorqueforce.condition. It's polling the External torques and forces (i.e. in your program, you stop, poll the torques and test on your condition). I don't understand exactly what you're trying to do, but you can choose what suits you best.
If you know when to test these external forces use normal foce polling (for example, you pick up work pieces, then sort them according to their weights), and if you don't know when that happens (say a human touches the robot) use conditions to triggers actions accordingly.Here's a small program how to poll the force on X axis. It's well explained in the documentation:
Code
Display Morepackage application; import com.kuka.roboticsAPI.applicationModel.RoboticsAPIApplication; import com.kuka.roboticsAPI.controllerModel.Controller; import com.kuka.roboticsAPI.deviceModel.LBR; import com.kuka.roboticsAPI.geometricModel.Tool; import com.kuka.roboticsAPI.geometricModel.World; import com.kuka.roboticsAPI.geometricModel.math.Vector; import com.kuka.roboticsAPI.sensorModel.ForceSensorData; public class Test extends RoboticsAPIApplication { private Controller controller; private LBR robot; private Tool nase; double minForce = 10; @Override public void initialize() { controller = (Controller) getContext().getControllers().toArray()[0]; robot = (LBR) controller.getDevices().toArray()[0]; nase= getApplicationData().createFromTemplate("Nase_Tool_In_Your_Object_Template"); nase.attachTo(robot.getFlange()); } @Override public void run() { ForceSensorData data = robot.getExternalForceTorque(nase.getFrame("/TCP"), World.Current.getRootFrame()); Vector force = data.getForce(); double forceInX = force.getX(); if (forceInX> minForce) { getLogger().info("force > min" ); //DoYourThingHere(); } } }
-
Looking for some help to get my 7th axis slide to move in a program with my tcp. Any examples someone can share for setting up coordinated motion in a programCan you please ask this in a separate thread, and detail what you want to do, it's not that clear.