IEEERobotics / high-level

CV, localization, mapping, planning, and generally anything that will run on the PandaBoard
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

unpickle_map fails #11

Closed dfarrell07 closed 11 years ago

dfarrell07 commented 11 years ago

The simplest way to recreate this error is to launch a Python interpreter in high-level/qwe and then run:

>>> import mapping.pickler as mapper
>>> course_map = mapper.unpickle_map("./mapping/map.pkl")

I get the following error:

>>> course_map = mapper.unpickle_map("./mapping/map.pkl")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mapping/pickler.py", line 38, in unpickle_map
    Map = pickle.load(pkl_file)
  File "/usr/lib/python2.7/pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "/usr/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 1069, in load_inst
    klass = self.find_class(module, name)
  File "/usr/lib/python2.7/pickle.py", line 1124, in find_class
    __import__(module)
ImportError: No module named CV_Map

I'll take a bit more of a look into this now, but I'm anxious to get back to nav code. Stay tuned for updates.

dfarrell07 commented 11 years ago

Are you seeing this behavior on your setup @rlsnow? Either way, can you please add the files generated by map2txt.py to the repo? This error prevents me from running that script, which is blocking some progress on the nav package. Having those files would make this issue much less critical for me.

rlsnow commented 11 years ago

I will check it out tonight @dfarrell. Prob has to do with some changes I made to map class on the last commit.

On Thu, Mar 21, 2013 at 4:51 AM, Daniel Farrell notifications@github.comwrote:

Are you seeing this behavior on your setup @rlsnowhttps://github.com/rlsnow? Either way, can you please add the files generated by map2txt.py to the repo? This error prevents me from running that script, which is blocking some progress on the nav package. Having those files would make this issue much less critical for me.

— Reply to this email directly or view it on GitHubhttps://github.com/NCSUhardware/high-level/issues/11#issuecomment-15225285 .

Ricker Snow North Carolina State University Student, Electrical and Computer Engineering NCSU IEEE Secretary

rlsnow commented 11 years ago

Seems to be working now @dfarrell07 . I think it was that previously the grid map was not a class. When unpickling a class the class must be in the module doing the unpickling, otherwise it doesn't know how to use the class i guess. Not sure why you got the ImportError about CV_Map though. Let me know if that keeps happening. Please read on.

use:

from map_class import MapClass

in any module that calls the unpickle functions. Keep calling the unpickle functions like you did above

Note that I have not been tracking .txt files and have stopped tracking .pkl files. So you will need to run map_script.py on your local machine to generate the .txt and .pkl files - that way you will be using the most recent commited map code and you can specify a lower map resolution if you want/need to.

I can start tracking them again if you think that would be best. I guess eventually we will want the .pkl files on git hub so the whole package works without calling map_script.py

dfarrell07 commented 11 years ago

We fixed this by adding qwe/mapping to controller's path.

import sys
sys.path.append("./mapping")