I'm writing some code for my robot's stereoscopic vision.
This is how I'm calculating the stereo vision in python (I'm using the roborealm API).
COGXR = rr.GetVariable("COG_X_RIGHT")
COGYR = rr.GetVariable("COG_Y_RIGHT")
COGXL = rr.GetVariable("COG_X_LEFT")
COGYL = rr.GetVariable("COG_Y_LEFT")
Z_Actual = (11 * 5.5)/COGXL-COGXR
X_Actual = (COGXL*Z_Actual)/(5.5)
Y_Actual = (COGYL*Z_Actual)/(5.5)
Whenever I run the program however, I get this error message:
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\Loren\Desktop\My Robots\RoboRealm\API\API\Python\SteroTestNINA.py", line 289, in <module>
Z_Actual = (11 * 5.5) / rr.GetVariable("COG_X_LEFT") - rr.GetVariable("COG_X_RIGHT")
TypeError: unsupported operand type(s) for /: 'float' and 'str'
This doesn't make much sense to me because COGXR and COGXL are not actually float or string variables. They come up as integers whenever I "print" them regularly. But for some reason when I stick them in an equation like this it wants to treat it as a float or a string.
Any idea's what I'm doing wrong?
BTW, haven't been to daniweb in a while