UR differtinates between variables (e.g p = p[0,0,0,0,0,0]) and poses (e.g fixed Waypoint_1 in a movel-command).
Im working on a script that needs to access poses. Currently I get a syntax error that says Waypoint_1 is not defined. The Pose is declared and used in a Move-Command. The Call of the Script is also after the call of the Move-Command.
I think the workaround to save the Pose to a variable would work, but is there any reason why poses can´t be directly accessed via script code ?
The Problem might be more related to the Move-command and the handling of the Waypoint instead of the general datatype pose.
For now i will save the pose to a variable, but Im thankful for every advice.
The Waypoint names only exist within the Polyscope program structure, they are not exported to script. If you look at the script generated from the URP you’ll see that the waypoint names only appear in the label messages, the move commands just contain the pose values. They also don’t appear in the variables tab. So your current method is correct, if you want to access them in script you must first assign them to a variable.
Thanks for your reply !
i am having similar troubles with scripts and poses. I have analized and conclude the same as you, as i see that you are well informed about this topic i would like to ask if you know a way to modify a pose value in a script, i have tried different ways, but i have not foud the correct method, i would really appreciate if you can help.
I’m not sure if you are able to edit waypoint values through a script. You are however able to use the waypoint values by taking the name of your waypoint and appending it with an _p for a pose or an _q for the joint values.
For example, if I have a waypoint defined in polyscope called
wpStart in my custom script function, I can call
wpStart_p for the pose and
wpStart_q for the joint values. To edit these values, you would most-likely assign a new variable (pose) with the value
wpStart_p and make any modifications to that variable.
pMid = pose_trans(wpStart_p,p[0,0,0.05,0,0,0])
I hope this helps!
Thanks for your reply, i just tested what you have recommend but unfortunately, it is not working for me, i am using version 3.11, do you have any further tips?
These _p and _q values are only available in e-Series 5.x software, not CB3 3.x.
What are you trying to do exactly? You can modify individual elements in a pose the same way as your can in a list - eg:
a = Waypoint_1 a = 0.2
i have a program where i have teached a lot of positions, there is a lot of programing logic and also scripting, now we have to deliver the machine and our end customer has requested a suitable teach mode for our robot, my client has someone on site that can teach positions but as the code is a little complex, my customer does not want to look for every positions in the code.
I try to program a teach mode in a separete urp, the first part is done i have the same waypoints and i save the data in installation variables.
Unfortuantely i have not achieved the second part, the second part consists in reading this installation variables and assigning it to the real waypoints avoiding the complexity to look for these positions in the software.
i am glad to hear suggestions
I’m not sure I fully understand your scenario… How many waypoints do you have that need to be modified? Are they defined in Script or Polyscope Waypoints?
If they are Polyscope Waypoints could you put copies of the key waypoints (linked to the waypoints down further in the program) in a folder at the start of the program that is not executed? If they have clear well defined names, these could be adjusted, and then the linked waypoint further down the program would also change.
Example below. Move command inside If False node would not execute.
Hi @ajp, can you provide a code sample for what you did here?
This was all just laid out in Polyscope using the link waypoints function for the sake of the screenshot, no code behind it really. What are you looking for in a sample?
thank you for the reply. I am not sure how to Add the “BeforeStart” Folder outside of the RobotProgram, while coding. I attach a screenshot of the function I have. I want it to be created before the RobotProgram tree, like on your screenshot.
I’m afraid I’m not equipped to provide much support on the Java SDK so one of the other guys can hopefully answer that question.
One alternative approach that I could recommend from a Polyscope perspective would be to add a folder below the Robot Program that doesn’t get executed, but again can’t tell you exactly how to do that in Java.