loading
 
Python -  getvariable returns null
Trent Sommerville from United Kingdom  [5 posts]
16 year
Hi,

I am unable to get the API server to return any variables created in VB scripts within the pipeline.

I am using python 2.5 here is a code snippet

print
while True:
    cogx= int(rr.GetVariable("cogx_right"))
    cogy= int(rr.GetVariable("cogx_left"))
    print "\rcogx_left: %d, cogx_right: %d" % (cogx, cogy),

The piple works fine, just not return on thje cogx_right and left that are from a VB script.

Any idea's ?

trent.
Anonymous 16 year
Trent,

Can you include your robofile so that we can attempt to replicate the error here?

Thanks,
STeven.
Trent Sommerville from United Kingdom  [5 posts] 16 year
Steve,

robo file attached.

trent.
program.robo
Anonymous 16 year
Trent,

We do not seem able to replicate your issue. We upgraded from 2.4 to 2.5 and everything seems fine. Can you try what we are doing to see if you are getting the same issues?

Attached is a much simplified robofile that basically hardcodes the variables. You can change their values by editing the Set_Statement module. Try download the latest Python API from the RR site and include the following at the end (instead of the current demo examples).

############################# Test program ##################################

# initialize the API class
rr = RR_API()

#connect to RoboRealm
rr.Connect("localhost")

print
while True:
    cogx= int(rr.GetVariable("cogx_right"))
    cogy= int(rr.GetVariable("cogx_left"))
    print "\rcogx_left: %d, cogx_right: %d" % (cogx, cogy)

rr.close()

Let us know if things seem to work here. If so then start backtracking in your robofile as to why those variables may not be set ... note that until we actually have an object in view those variables will be zero.

STeven.

program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index