Your plane, Tray_1, is a pose variable. I am not sure how you got the first part, Tray_1 = Tray_1[2] + value. Maybe the Assignment node creates a new variable of the same as your plane, but it is a float type. If Tray_1 and Tray_1_const are both pose the code will work.
Tray_1 is a Plane created using the features menu in installation.
Which is a and thus so can be modified, Hence Tray_1 = Tray_1[2] + value (value is an arbitrary No) which works as expected and adjusts the Z value of the plane.
as I understand it, when Tray_1 is created the Robot also creates a Tray_1_const which has the exactly the same values as Tray_1. However as its a constant it cannot be modified!
as indicated in my original post
Tray_1 = Tray_1_const works fine when its used in the main body of the program in an assignment,
So my question is why doesn’t it work from a Script file?
are values not accessible in a script file? (I find that hard to believe)
From my experience, the Const version of the feature is not global. You can actually test this by manually typing Tray_1_const into your assignment node and watch it fail. For whatever reason, that const variable HAS to be selected from the dropdown menu. You therefore must pass the const version into your script via a function call and reassign your plane that way, if you want to do it all with script. I haven’t done it myself, but it might be interesting to see the script polyscope generates when you do the assignment node, since it works there for some reason.
He means if you are changing Tray_1 which is a Pose variable into a float variable with that Tray_1 (Pose) = Tray_1[2] (float) + value (assuming float). If you are trying to change just the z value it would be Tray_1[2] = Tray_1[2] + value. Also eric is right where you should choose the constant variable from the drop down box if you are using the Script node. If you are manually typing the script from your own URCap then you would need to pull the Pose data from the installation node. I believe the UR side doesn’t actually have a variable in the script made for the const but places the original pose there instead.
For Instance your variable Tray_1 would show up in the Script as “Tray_1” so if you did Tray_1 = Tray_1 that is exactly what you would see in the Script. If you do Tray_1 = Tray_1_const though by selecting the const from the dropdown box, you would actually get Tray_1 = p[some_data] and not Tray_1 = Tray_1_const. So when you type in Tray_1_const it does not know what variable you are referencing.
I have attached an image with an example showing this. On the left is the program when the first Plane_1_const I selected with the Drop down and the second one I physically typed in.
The reason this does not work from a script file (or typing in the logical script commands) :
Tray_1 = Tray_1_const
is because Tray_1_const does not really exist as a truly global variable. It ONLY exists in the mind of the Polyscope editor. When you select it from a dropdown in the expression editor of polyscope the polyscope editor will pull in the actual pose value for Tray_1 (as taught in the Installation) and substitute this for the underlying script it generates.