I have a vcStatement object of type VC_STATEMENT_PATH, and I am trying to get some attributes of the individual vcPositionFrame elements within that path statement as follows (pseudo-code):
if statement.Type == VC_STATEMENT_PATH:
a = statement.Positions[index].Name # (i.e. PP2 - P3)
Per the API it seems like I should be able to access these attributes, but I get an error in the terminal saying all of those attributes cannot be found except for “PositionInReference”.
Is it possible to access these attributes for points within a path statement? If so how would I go about getting them?
Good question. I believe the answer to your question is that statements have names but points do not. So PP4, PP17, etc. are just representations of indices of points in a path statement.
With a path statement, schema properties can be used to define names and the visibility of those names for path points.
I believe the 4.1 version of Python API should show new properties and a code example on how to do this. And a new Python Robotics tutorial about a path statement will be coming in July, including the creation of arcs and face-plane intersection for robot path planning.
Thanks for the update.
My question is in the context of creating an XML-based tool-path exporter. For the time being I don’t mind assigning my own names/IDs to those points within a path statement based on their index in the list.
However, since I also cannot get the configuration property associated with those individual points, is it appropriate to assume that all points within a path statement utilize the same robot configuration? Is it even possible to get the configuration property from a path statement?
Take a look at the vcPathStatement and vcLayoutSchemaPropertyList topics in Python API. Consider using the latter for more customization, but others would know best.
I don’t remember off-hand how the configuration works in API for path statement, but reference points do play a factor in that.
You can go wild and try adding a configuration scheme property to a path statement, but whether or not the executor of the path statement uses it is another story.
- Take the approach of adding a Python Process Handler behavior to your robot and assigning it to the robot's Executor behavior::StatementHandler property (4.1 feature). That frees up a lot of worry and headaches because the handler has an OnStatementExecute event that allows you to control the execution of default statements like Path, PTP and Comment. So when the path statement is executed, you could loop through all the points, check the configuration, and then control the robot motion to the point using the desired configuration, speed, etc. For all other statements, they would execute normally unless you specifically alter them in the handler.
- Take a look at vcPythonProcessHandler in Python API for info and code example.
But, of course, others here probably have their own XML tool path solutions, so maybe they can share :)