If the pose is considered, a frame can't be transformed into what it appears in the mirror, because the xyz axis in mirror can't comply with right hand law.
But if abc is not considered, you can simply reverse the sign of y to get the symmetric point in your case.
Posts by greengrape83
-
-
Maybe you can put your source code. It is difficult to judge just from the description.
-
If you use breakwhen, only the current motion will be cancelled, but there may be multiple motions have been queued and these queued motions will be executed.
You can cancel all the motions you have sent(current motion and the queued motions) by -
I have noticed that someone has used IOGroup in another subject.
You may need the similar group and you can get the AbstractIO from the group just like the following. Wish it be helpful. -
Maybe I have misunderstood you question. These IOCondition is only for monitoring the change of an IO. But signal is a much wider conception.
-
The first argument of the BooleanIOCondition is an AbstractIO instance, which you can get it from you IOGroup.
I'm not sure what userButtonPressed is. -
You can create BooleanIOCondition or IORangeCondition, and then use waitFor method of ObserverManager.
CodeBooleanIOCondition ioCon = new BooleanIOCondition(inOut, booleanIOValue); getObserverManager().waitFor(ioCon);
What about "Wait" for an incoming signal, i.e. the program halts until said signal? -
It seems that you forget to add the @Inject annotation tag for controller member in the IO_02 class.
You have some misunderstanding about the @Inject mechanism.
Also you can write you app like the following:Code
Display Morepackage application; import javax.inject.Inject; import com.kuka.common.ThreadUtil; import com.kuka.generated.ioAccess.LEDIOGroup; import com.kuka.generated.ioAccess.MediaFlangeIOGroup; import com.kuka.generated.ioAccess.LEDIOGroup; import com.kuka.roboticsAPI.applicationModel.RoboticsAPIApplication; import static com.kuka.roboticsAPI.motionModel.BasicMotions.*; import com.kuka.roboticsAPI.controllerModel.Controller; import com.kuka.roboticsAPI.deviceModel.LBR; public class IO_02 extends RoboticsAPIApplication { @Inject private LBR lBR_iiwa_14_R820_1; @Inject private LEDIOGroup LEDIO; @Override public void initialize() { // initialize your application here } @Override public void run() { // ------------------------------------------- getLogger().info("First part"); LEDIO.setLEDBlue(true); } }
-
You can use a PositionHold motion with 3 seconds between these two motions.
Another choice is after the first motion is finished, block the current thread for 3 seconds and then trigger the second motion.
But if you provide more details about you application scenario, we can give more choice. -
Generally speaking, in any programming language, it is not a good habit to kill a thread(application) abruptly, because you never know what it is doing. If it is operating some critical object or data and is killed in the midst, these critical object will be dirty.
Actually there are 4 ways to terminate a thread in java
(1)Normal return
But sometimes it can't handle complicated scenario.
(2)Monitoring a flag. If it is time to exit the thread, you set the flag true to break the outer loop, which is the choice you have made.
Its defect is that you can't terminate a blocked thread in this way.
(3)interrupt() method of thread
When a thread's interrupt() method is called, the thread's code branch will throw an InterruptException exception if it was blocked or its method isInterrupted()/interrupted() will return true if it was running.
(4)stop() method of thread
It kills thread immediately but not safe, as mentioned. Also it is marked as depreciated. -
You can use the following code lines to singal the current application to stop and in your main thread, the InterruptedException shouldn't be caught.
It isn't a decent way.Code
Display Morefinal Thread mainThread = Thread.currentThread(); ICondition c = ForceCondition.createSpatialForceCondition(_lbr.getFlange(), 15.0d); getObserverManager().createAndEnableConditionObserver(c, NotificationType.OnEnable, new IRisingEdgeListener() { @Override public void onRisingEdge(ConditionObserver conditionObserver, Date time, int missedEvents) { // Stop the current application mainThread.interrupt(); } }); ......
Hello,I have a simple question, can we kill the running application with a simple Command ( function abort for exemple or something like that ) ?
Thanks
-
The toString of JointPosition truncates the data into 2 decimals.
But if you use method lbr.getCurrentJointPosition().get(JointEnum.Jx), you can get the real data with much more decimals. -
The whole process is
(1)get the vector ab and ac, where frame a as the reference coordinate system.
(2)check whether ab and ac are on the same line. If so, throw exception.
(3)ab cross ac is the normal direction of new base, where frame a as the reference coordinate system.
(4)calculate the angle from reference coordinate system's z vector(0,0,1) to the new base's normal direction by the right hand law.
I)if the z vector and the normal direction is on the same line(angle is 0 or Pie), choose any vector except z as the pivot to rotate around.
II) else choose the real pivot vector to rotate around. The pivot vector is the cross of the two vectors.
(5) value Transformation.of(Vector.of(0.0, 0.0, 0.0), AxisAngleRotation.of(rotAxis, rotAngle)) is the Transformation from frame a to the new base.
(6) So the final base frame should combine the reference frame a and the transformation together.
Welcome to any questions and suggestions.
Thanks for answer me.
I understand what you mean until this moment :double rotAngle = startZ.angleRad(direction);
Vector rotAxis = null;
if (rotAngle == 0.0 rotAngle == Math.PI)
{
rotAxis = Vector.of(1.0, 0.0, 0.0);
}
else
{
rotAxis = startZ.crossProduct(direction);
}return new Frame(a, Transformation.of(Vector.of(0.0, 0.0, 0.0), AxisAngleRotation.of(rotAxis, rotAngle)));
I don't understand what are RotAngle and RotAxis, and i don't understand the return frame, can you explain more please ?
Sorry for my bad English. -
It seems that there is no such api in sunrise api. So I wrote something like the following as the base generator for our project.
Code
Display More/** * Generate a base frame from frame point a, b, c by right hand law. The base frame' z direction is the normal * direction of base abc. */ public static Frame generateBaseFrame(AbstractFrame a, AbstractFrame b, AbstractFrame c) { Vector startZ = Vector.of(0.0, 0.0, 1.0); Vector direction = a.getOriginOf(b).toVector().crossProduct(a.getOriginOf(c).toVector()); if (direction.equals(Vector.of(0.0, 0.0, 0.0))) { throw new IllegalArgumentException("These 3 frames can't produce a base frame."); } double rotAngle = startZ.angleRad(direction); Vector rotAxis = null; if (rotAngle == 0.0 || rotAngle == Math.PI) { rotAxis = Vector.of(1.0, 0.0, 0.0); } else { rotAxis = startZ.crossProduct(direction); } return new Frame(a, Transformation.of(Vector.of(0.0, 0.0, 0.0), AxisAngleRotation.of(rotAxis, rotAngle))); }
-
-
I've encountered the same issue.
You can create another folder like 'lib' paralleling with the existent folder 'KUKAJavalib'.
Put you jason lib into 'lib' folder and push it into project references.
Then it can be deployed.
Hi,I made a project for KUKA, where I use javax.json library. I've imported jar to project referencies, and all dependancies seem to be ok. But when I try to deploy project to robot I see following error:
How can I resolve it?
UPD: I attach screen with lib tree.
-
Maybe you can teach a base frame by which you can measure the force in x/y/z direction.
You can define x+ as right, y+ as forth, z+ as up. It can tell the direction correctly when force happens on axis 6/7. For force on other axis, it works not well.Code
Display MoreObjectFrame oFrame = getFrame("/directbase"); ICondition forceCondition = new ForceCondition(lbr.getFlange(), oFrame, EnumSet.of(CoordinateAxis.X, CoordinateAxis.Y, CoordinateAxis.Z), 15.0d); IMotionContainer container = lbr.move(positionHold(new PositionControlMode(), -1, TimeUnit.SECONDS).breakWhen(forceCondition)); if (container.hasFired(forceCondition)) { double x = lbr.getExternalForceTorque(lbr.getFlange(), oFrame).getForce().getX(); double y = lbr.getExternalForceTorque(lbr.getFlange(), oFrame).getForce().getY(); double z = lbr.getExternalForceTorque(lbr.getFlange(), oFrame).getForce().getZ(); if (Math.abs(x) >= Math.abs(y) && Math.abs(x) >= Math.abs(z)) { getLogger().info("x:" + (x > 0.0 ? "+" : "-")); } else if (Math.abs(y) >= Math.abs(x) && Math.abs(y) >= Math.abs(z)) { getLogger().info("y:" + (y > 0.0 ? "+" : "-")); } else { getLogger().info("z:" + (z > 0.0 ? "+" : "-")); } getLogger().info(lbr.getExternalForceTorque(lbr.getFlange(), oFrame).getForce().toString()); }
Hi,I was wondering if there is a way to check if a force is coming from the left or right (see attached)?
I would like to put that in something like an if/else statement and program different actions .Thank you.
robotneuling -
The 'while' loop is a good idea for the application containing only one motion.
But I'm not sure it can handle a normal robot application case.
A normal robot application always contains a set of motions. And collision pause/resume should be applied to most of the motions.The following is the way that I have used to handle the similar situation. I wish it be helpful.
Code
Display More// Some impedance mode may be necessary... //TODO: // Collision condition ICondition collisionCondition = ForceCondition.createSpatialForceCondition(lbr.getFlange(), 15.0d); // Collision observer ConditionObserver collisionObserver = getObserverManager().createAndEnableConditionObserver(collisionCondition, NotificationType.OnEnable, new IAnyEdgeListener() { @Override public void onAnyEdge(ConditionObserver conditionObserver, Date time, int missedEvents, boolean conditionValue) { if (conditionValue) { // Here a collision is detected and try to freeze the robot getApplicationControl().setApplicationOverride(0.0d); } else { // Some extra judgements may be necessary for force wobble when motion paused... // TODO // Here a collision is removed and try to unfreeze the robot getApplicationControl().setApplicationOverride(1.0d); } } }); // A set of motions to go with the supposed the path. If collision detected, the current motion freezed. If collision removed, the motion continue. lbr.move(ptp(getApplicationData().getFrame("/P1"))); lbr.move(lin(getApplicationData().getFrame("/P2"))); lbr.move(circ(getApplicationData().getFrame("/P3"), getApplicationData().getFrame("/P4"))); lbr.move(ptp(getApplicationData().getFrame("/PTarget"))); // Disable and remove the observers. collisionObserver.disable(); getObserverManager().removeConditionObserver(collisionObserver);
Hi greengrape83,So you would integrate that pair of methods into the while loop?
For what reason?
I haven't really used setApplicationOverride so far that's why I am asking. -
If you stop a motion by 'breakwhen', you need to handle trivial details to resume the motion because there are several kinds of motions with different parameters.
But by the following pair of methods you can actually freeze and unfreeze the robot.