|
Accessing the API Mahesh from India [5 posts] |
17 year
|
Am sorry, I thought Title was something like nick... Anyways here's my Question....
I have been trying to access the Robo Realm API using Python. When I try to access the variables that have been set by the Modules, Robo Realm returns with an empty string like
"<response></response>"
And hence my RE's don't match.
And only those variables which I set through the API are returned properly.
How can I access variables such as COG. Is the procedure the same as for getting user defined variables?
And how are we to know the exact name of the variables instantiated by the modules?
It will be helpful if the RR Team could provide us with a detailed documentation file containing things like channels and corresponding numbers etc.
Or otherwise we have to create a .robo file and extract it from that all the time.
Secondly, Is it sensible enough to use Python to access the RoboRealm API considering my application is a Real Time one?
Thanks
MNM
PS:Robo Realm is an Amazing Software. I feel its incomplete without a detailed documentation.
|
|
|
Anonymous |
17 year
|
Mahesh,
To find out what variable are accessible use the Statements->Watch_Variables module. This will show all variables and most of their values (it will truncate some array values). You need to use exactly these names in the API calls in order to get their values. For example, the COG is represented as COG_X and COG_Y (two variables).
Note that based on where you place the watch_variables module the variable values may differ as it represents the values at that point in the processing pipeline.
"It will be helpful if the RR Team could provide us with a detailed documentation file containing things like channels and corresponding numbers etc." - can you give us an example? What do you mean by a channel? A great deal of the functionality is documented on the website. Perhaps it is just a little hard to find?
In terms of performance, it will depend on what you're doing. Using python to access a couple variables in RR is fine for real-time performance ... however, if you intend to do a lot of analysis on those resulting numbers like least square fitting, etc. Python may not be the best option. For other simple storing, controlling, relaying of information it should be fine. Python is often used in the Robotics community to control systems.
STeven.
|
|
|
Watch Window Mahesh from India [5 posts] |
17 year
|
I figured out that I could use the watch window to find the names of the variables. I am attaching the code and the response... Kindly have a look at it and please let me know where exactly I am going wrong.
I was talking about channels in the RGB_Filter module. Say for example, I could figure out that Red is first, Green 2nd and Blue 3rd, but I couldn make out that yellow will be channel 64... how can I find out the channel numbers apart from ripping it off from .robo file???
About The Files:
The first one is the console response to the code. I was trying to find out the variable names by making a request for all variables and printing the XML response. But as you can see from the 1st attachment, that it returns with
<response></response>
The second one is the code of the ReadAll Function.
Other parts of the API are perfectly working fine as I haven made any changes to it. Except that, I compiled the regular expressions as I might be needing it a little frequently.
PS: I am sorry if I had offended the RR Team. The documentation was precise, at the same time concise. But may be I felt that it needed more details. Thanks for this wonderful software!
|
|
|
Anonymous |
17 year
|
Mahesh,
Thanks for the detailed post. That makes things much easier for us.
We were able to replicate your problem. It appears there was a timing issue with the get_all_variables which would mostly make the return value empty as you noted. Interestingly, if you tried it many times in succession it sometimes would work. Regardless, a fix has been added and uploaded to the site. Please download 1.8.5.8 to get that fix.
Note we've also added your ReadAll routine into the Python library for others to use.
Thanks,
STeven.
|
|
|
Anonymous |
17 year
|
Mahesh,
P.S. We apologize if the last email made it appear that we were offended ... in fact we are not but are just very eager to understand how to improve the site/documentation/product. What you mention is correct. There is no detailed spec on all the parameters of the XML strings and you have to currently rely on the GUI to generate the .robo file in order to understand what parameters to use. Hopefully this will change sometime in the future with much more detailed documentation about each parameter and its values.
Thanks,
STeven.
|
|
|
API Reference Mahesh from India [5 posts] |
17 year
|
Can we contribute?! Mabbe we can do something. I hope the thing is transparent enough. Atleast the documentation can be made open? Something like wiki? So that as the program gets bigger, so will the documentation automatically.
That was just a suggestion! Neways, thanks for the patch. I'll get it updated.
|
|
|
Anonymous |
16 year
|
Mahesh,
Thanks very much. We've added the pre-compiled regex statements to the API. Makes a nice addition since it is performance related.
We're hoping to open up a little more of the website with user submitted comments/notes on most pages which should hopefully make adding content a little easier. Look for that to be added in the next few weeks.
Thanks for your comments!
STeven.
|
|