luigifreda / pyslam

pySLAM contains a Visual Odometry (VO) pipeline in Python for monocular, stereo and RGBD cameras. It supports many modern local features based on Deep Learning.
GNU General Public License v3.0
1.86k stars 335 forks source link

attribute error related to g2o #2

Closed sidtalia closed 4 years ago

sidtalia commented 4 years ago

Hi, I am quite new to computer vision based localization and just wanted to try this out. When running the main_slam.py I get the following error.

  File ".../pyslam/optimizer_g2o.py", line 96, in optimization
    edge.fx = f.fx 
AttributeError: 'g2o.EdgeSE3ProjectXYZ' object has no attribute 'fx'

I understand that this error is related to g2opy, but I was wondering how everyone else got around this, since the above object has not been used in any of the examples given in g2opy. It would also be helpful if there was another way to obtain whatever is required here (as in, if there is a member function of that object from which I should get the values).

P.S: I made no changes to the source code of pyslam or g2o

sidtalia commented 4 years ago

I figured out this particular error. You have included a replacement file in pyslam/lib/g2opy_changes

types_six_dof_expmap.h

For anyone else getting this error, you have to replace the file in

g2opy/python/types/sba/

and then install g2o (assuming you have already created the build directory)

cmake ..
make -j8
cd ..
python3 setup.py install

@luigifreda please include these instructions in the readme.

luigifreda commented 4 years ago

Hi, the error you experienced was due to the fact that you did not use the provided installation script. Please, read the install instructions.

In any case, check the new pySLAM v2. New features and new instructions.

robovis commented 4 years ago

Even in the modified files, the EdgeStereoSE3ProjectXYZOnlyPose() is not fully included (attributes like fx, fy, ...). I suppose adding a few lines in the types_six_dof_expmap.h should solve the problem.

robovis commented 4 years ago

Here is the updated file: types_six_dof_expmap.zip

luigifreda commented 4 years ago

Hi, thanks for your note. Everything that is needed for the installation is in this file https://github.com/luigifreda/pyslam/blob/master/thirdparty/g2opy_changes/types_six_dof_expmap.h If you have troubles, the reason is that you did not use the required install script https://github.com/luigifreda/pyslam/blob/master/install_thirdparty.sh as explained here. Please, read the install instructions and take a look at this file too.

robovis commented 4 years ago

I've already looked at the files you mentioned. The problem is that the public attributes you've added are only for the "EdgeSE3ProjectXYZ" and "EdgeSE3ProjectXYZOnlyPose" edges. You've left out public methods (like fx, fy, cx, cy, bf) for "EdgeStereoSE3ProjectXYZ" and "EdgeStereoSE3ProjectXYZOnlyPose".

BTW I'm writing an ORB-SLAM2 equivalent in python using g2o and pyDBoW. Would that be useful for your repo?

YJonmo commented 1 year ago

I've already looked at the files you mentioned. The problem is that the public attributes you've added are only for the "EdgeSE3ProjectXYZ" and "EdgeSE3ProjectXYZOnlyPose" edges. You've left out public methods (like fx, fy, cx, cy, bf) for "EdgeStereoSE3ProjectXYZ" and "EdgeStereoSE3ProjectXYZOnlyPose".

BTW I'm writing an ORB-SLAM2 equivalent in python using g2o and pyDBoW. Would that be useful for your repo?

Hi there,

Do you have a link to your ORB-SLAM2 equivalent in python?