ToniRV / Kimera-VIO-Evaluation

Code to evaluate and tune SPARK VIO pipeline.
MIT License
21 stars 2 forks source link

pandas_bridge.df_to_trajectory error in backend jupyter notebook #56

Closed geothan closed 3 years ago

geothan commented 3 years ago

Description: In backend notebook, the execution of

vio_output_dir = "/home/george/Kimera-VIO-Evaluation/results/V1_01_easy/Euroc/" gt_data_file = "/home/george/datasets/EuRoC/ASL_Dataset_format/V1_01_easy/mav0/state_groundtruth_estimate0/data.csv" gt_df = pd.read_csv(gt_data_file, sep=',', index_col=0) gt_df = gt_df[~gt_df.index.duplicated()] traj_ref_complete = pandas_bridge.df_to_trajectory(gt_df)

returns error. Why does it happen?

Console output:


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-43-cdf3f5517f57> in <module>()
      1 # Convert the gt relative-pose DataFrame to a trajectory object.
----> 2 traj_ref_complete = pandas_bridge.df_to_trajectory(gt_df)
      3 
      4 # Use the backend poses as trajectory.
      5 traj_est_unaligned = pandas_bridge.df_to_trajectory(output_poses_df)

/home/george/venv/local/lib/python2.7/site-packages/evo/tools/pandas_bridge.pyc in df_to_trajectory(df)
     50     if not isinstance(df, pd.DataFrame):
     51         raise TypeError("pandas.DataFrame or derived required")
---> 52     positions_xyz = df.loc[:,['x','y','z']].to_numpy()
     53     quaternions_wxyz = df.loc[:,['qw','qx','qy','qz']].to_numpy()
     54     # NOTE: df must have timestamps as index

/home/george/venv/local/lib/python2.7/site-packages/pandas/core/indexing.pyc in __getitem__(self, key)
   1492             except (KeyError, IndexError, AttributeError):
   1493                 pass
-> 1494             return self._getitem_tuple(key)
   1495         else:
   1496             # we by definition only have the 0th axis

/home/george/venv/local/lib/python2.7/site-packages/pandas/core/indexing.pyc in _getitem_tuple(self, tup)
    886                 continue
    887 
--> 888             retval = getattr(retval, self.name)._getitem_axis(key, axis=i)
    889 
    890         return retval

/home/george/venv/local/lib/python2.7/site-packages/pandas/core/indexing.pyc in _getitem_axis(self, key, axis)
   1900                     raise ValueError('Cannot index with multidimensional key')
   1901 
-> 1902                 return self._getitem_iterable(key, axis=axis)
   1903 
   1904             # nested tuple slicing

/home/george/venv/local/lib/python2.7/site-packages/pandas/core/indexing.pyc in _getitem_iterable(self, key, axis)
   1203             # A collection of keys
   1204             keyarr, indexer = self._get_listlike_indexer(key, axis,
-> 1205                                                          raise_missing=False)
   1206             return self.obj._reindex_with_indexers({axis: [keyarr, indexer]},
   1207                                                    copy=True, allow_dups=True)

/home/george/venv/local/lib/python2.7/site-packages/pandas/core/indexing.pyc in _get_listlike_indexer(self, key, axis, raise_missing)
   1159         self._validate_read_indexer(keyarr, indexer,
   1160                                     o._get_axis_number(axis),
-> 1161                                     raise_missing=raise_missing)
   1162         return keyarr, indexer
   1163 

/home/george/venv/local/lib/python2.7/site-packages/pandas/core/indexing.pyc in _validate_read_indexer(self, key, indexer, axis, raise_missing)
   1244                 raise KeyError(
   1245                     u"None of [{key}] are in the [{axis}]".format(
-> 1246                         key=key, axis=self.obj._get_axis_name(axis)))
   1247 
   1248             # We (temporarily) allow for some missing keys with .loc, except in

KeyError: u"None of [Index([u'x', u'y', u'z'], dtype='object')] are in the [columns]"

Additional files: Please attach all the files needed to reproduce the error.

Please give also the following information:

remove this line and paste your config HERE

ToniRV commented 3 years ago

Can you print gt_df? My guess is that cols are named with euroc convention, but the df_to_trajectory seems to ask for x,y,z. Euroc convention is:

#timestamp, p_RS_R_x [m], p_RS_R_y [m], p_RS_R_z [m], q_RS_w [], q_RS_x [], q_RS_y [], q_RS_z [], v_RS_R_x [m s^-1], v_RS_R_y [m s^-1], v_RS_R_z [m s^-1], b_w_RS_S_x [rad s^-1], b_w_RS_S_y [rad s^-1], b_w_RS_S_z [rad s^-1], b_a_RS_S_x [m s^-2], b_a_RS_S_y [m s^-2], b_a_RS_S_z [m s^-2]