loading
 
Python in separate editor
Thomas Wagner from Germany  [51 posts]
3 years
STeven,

you mentioned earlier that it makes sense to do python development for more complex programs in a separate editor, no disagreement there. But some questions:

1. It seems that I always need to comment out the lines "import rr" etc, there is no such module I could import in an external editor to run properly? At least I have not found rr.*, neither in RoboRealm directories nor in python. This is a little bit inconvenient for external debugging.

2. If you call an extrernal python routine, there will obviously be always some interface with variables, which get passed by things like rr.GetStrVariable and
rr.SetArrayVariable. Since this does not work for an external editor, one has to first write a routine which writes things to files. While I use write_variables for this at the moment, format for this is very un-pythonic, so I might be better of using some python write funktion, since this would use a format I could read again easier.

The most elegant way would be to write an rr.py that I can use for my external python editor and which lets rr.GetStrVariable and rr.SetArrayVariable directly use the values from a running RoboRealm (from memory). But might be complicated.

If that approach does not work, having at least a pythonic file format in "write variables" as a third selection (aside from xml and html) would be great. You may probably want to look into Pickle: https://docs.python.org/2/library/pickle.htmlPickle

Thomas
Steven Gentner from United States  [1370 posts] 3 years
Thomas,

I may have misspoken, the idea was to use an external editor to modify just the file that RR loads into the python module ... which is what I think you were already doing. Developing Python externally one would use the API and control RR via that. In this case the RR Python lib can be downloaded from

http://www.roborealm.com/help/API.php

as there is a small python example of how to execute some of the API functions. We typically don't keep the python lib up-to-date so you can either use the native python functions over TCP/IP or use the COM object which is kept up to date along with the C++ lib.

Note that some of the api functions like getImage will be a bit slow in python.

STeven.

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