Accessing Feature Pose Value

I am trying to access an Installation Feature from my program node code.

this.featureModel = api.getProgramAPIProvider().getProgramAPI().getFeatureModel();
Collection<Feature> lineFeatureList = featureModel.getGeomFeatures(new Filter<Feature>() {
    public boolean accept(Feature element) {
        LOGGER.info("Feature " + element.getName() + " pose = /" + element.getPose().toString() + "/");
        return element instanceof FeatureLine; 
    }
});

The poses I am getting are different than the poses set by the installation file. Am I doing something wrong?

Hi @ocohen,

Can you give more details on how they differ ?

Polyscope will print the pose in meters/radians(rotation vector) and with respect to base feature/frame.

Ebbe

I have found a workaround for my problem, but would still like to understand the proper way of doing it.

Here’s some more details:

I have setup a Conv feature touching two screw points on my conveyor’s chassis. And set up conveyor tracking using it works fine if I am using the Conveyor Tracking wizard.

However if I am trying to use the same feature to track a conveyor from urscripts:
track_conveyor_linear(Conv, 2500000, 0)
This results in tracking to a completely wrong direction.

For debugging I created a Conveyor Tracking wizard node, and checked the .script file to see how it works under the hood. It actually subtracts the two point features instead of using the line feature:

track_conveyor_linear(
    pose_sub(
        p[0.17618015612116103,
          0.2888867189387522,
          0.0041121763977068765,
          2.6904154016660575,
          -1.4021931995541972,
          0.004540402182327259], 
        p[-0.4808430140572028,
          0.31506190698267633,
          0.009952606914532765,
          2.8725817683539336,
          1.2526583452730924,
          -0.06348787362283329]
    ),
   2500000, 0
)

Except that these points are not set as feature, so there is no easy access to them.

Now on the URCaps side, I can access the Line Feature using: element.getPose().toString() which gives me the same problem as using track_conveyor_linear(Conv, 2500000, 0).
What I did to overcome this was to use the deprecated functions:
GetPoint1() GetPoint2() and subtract them.
This works, but since these are deprecated, I don’t believe I am supposed to use them. And I dont know if there is any guarantee they would stay in the API.

Hi @ocohen,

I see your challenge. Your clue from the Line feature is actually the orientation, since the Y-axis is aligned with the vector between the two points. You can calculate the pose direction vector by:

pose_sub(Line_X_const, pose_trans(Line_X_const, p[0,1,0,0,0,0]))

Ebbe

Right, so the feature is a pose who’s rotation vector is pointing in the line’s direction, and the conveyor function is expecting a translation vector pointing in the line’s direction.

The only thing I didn’t understand from your answer is Line_X_Const. Shouldn’t this be Conv? Why do you say x is constant?

No it is not necessary to be a constant variable. But the built in conveyor tracking is using the constant Line feature and is not considering any change runtime.

Ebbe