Universal Robots+

How do I create a Plane feature?

I want to create a plane to use as a coordinate system in our URCap, however I can’t figure out how to use FeaturePlane. The FeaturePlane.getPointx() method is deprecated, so would I have to use FeaturePlane.getPoint() or Feature.getPoint()? Also, if you could provide a simple example, that would be much appreciated.

Thanks

I managed to create 3 points, but couldn’t figure out how to use URScript outside the generateScript() method. Also I got nowhere with FeaturePlane. If someone could help with that, I ould be forever grateful.

Hi Viktor,

If you want to add a Feature for your URCap, you can use the FeatureContributionModel class (only for SDK versions 1.9 and up) to add Feature variables specific to your URCap. These are special Features that are not modifiable by the user on Polyscope, and are only controllable through your URCap. I think this class is only available in the InstallationNodeContribution via the InstallationAPIProvider class. You can get it by doing something like

apiProvider.getInstallationAPI().getFeatureContributionModel()

Afterwards, you can call addFeature(), getFeature(), removeFeature, and updateFeature() through the FeatureContributionModel. Remember that a Feature is represented internally by a Pose, so you’ll have to provide that as well when you add a feature.

I managed to create 3 points, but couldn’t figure out how to use URScript outside the generateScript() method.

Well, URScript is the Python-like code that will run on the actual robot, when it comes time to play/run your polyscope program. The Java code you write for your URCap ultimately needs to provide its portion of URScript in the generateScript() method.

Are you asking this question because you’re using pose_trans() and other pose manipulation methods to generate your plane feature? If so, you’ll need to do the math in Java (there’s a helpful post that did this already: Pose_trans and pose_inv functions in URCap)

1 Like

Hi @joshua,

Thank you very much for your reply. If I understand correctly, in SDK version 1.10 I can’t create a specific Plane feature, only a generic Feature, but it should have the same functionality as the Plane feature. If so, I’m much more close to solving my problem.

I asked about URScript, because I have no idea how it could be used in Java, but if I don’t have to use it, as I can calculate everything directly in Java, then it’s not much of a problem right now.

Thank you very much again. Your comment was tremendous help.

With the FeatureContributionModel, you’ll only be able to make Features, yes.

I can’t create a specific Plane feature, only a generic Feature, but it should have the same functionality as the Plane feature.

Yes, internally in Polyscope, a feature is simply represented by a Pose. The FeatureContributionModel can help you store/edit a Pose as well, so it will functionally be the same as storing a Plane feature (assuming you do any math necessary to create the Plane feature).