Cancel
Showing results for 
Search instead for 
Did you mean: 

Adding attributes to TxRobot

Just wondered if anyone had tried adding their own attributes to a TxRobot?

I'd like to make use of the Attributes of a TxRobot. Have tried a number of variations on the following (string attributes etc):

                    TxAttribute a = new TxNoValueAttribute("MyAttribute");
                    Robot.Attributes.Add(a);

The Attributes list is not read-only, and no error is raised, but when watching the value of the robot's attributes, nothing is added by these lines. Seems like the Set method does nothing.

 

To give a bit of context, I'm trying to store some markers representing aspects of the robot (e.g. what processes it's carrying out). I'd like to store it with the robot itself, rather than having to create a separate file (e.g. xml) and matching up robots with their attributes, which seems clumsy. If there is a better way than (ab)using the attributes, I'd be interested.

2 REPLIES

Re: Adding attributes to TxRobot

For anyone looking to do the same: there is are Set/RemoveAttribute methods of the robot.
Not sure how I missed that!

Re: Adding attributes to TxRobot

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi  Cypherspaceman,

 

The design of the API is such that when you call Robot.Attributes, each time it constructs and returns a new ArrayList. Modifying that list will not affect the robot.

 

Best Regards,

DianaG