clynamen / nuscenes2bag

nuScenes dataset to rosbag format
136 stars 33 forks source link

Minor suggestions to code #2

Closed ChernoA closed 4 years ago

ChernoA commented 4 years ago

Specify C++17 version, correct CMake version, correct Boost version.

anshulpaigwar commented 4 years ago

I get following error upon using this pull request

anshul@encre:~/catkin_ws$ rosrun nuscenes2bag nuscenes2bag --sample_dir /home/anshul/mini/us/v1.0-mini/ --out nuscenes_bag/
Forcing at least one job number (-j1)
Loading metadata...
Initializing 1 threads...
Found 10 scenes in directory
Converting log 1 of 10, scene-0061
Progress: 0% [0/31206]
[pcl::PCDReader::readHeader] Could not find file '/home/anshul/mini/us/v1.0-mini/samples/RADAR_FRONT/n015-2018-07-24-11-22-45+0800__RADAR_FRONT__1532402927664178.pcd'.
Could not read /home/anshul/mini/us/v1.0-mini/samples/RADAR_FRONT/n015-2018-07-24-11-22-45+0800__RADAR_FRONT__1532402927664178.pcd
nuscenes2bag: /usr/include/boost/smart_ptr/shared_ptr.hpp:648: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = nuscenes2bag::RadarObjects_<std::allocator<void> >; typename boost::detail::sp_member_access<T>::type = nuscenes2bag::RadarObjects_<std::allocator<void> >*]: Assertion `px != 0' failed.
Aborted (core dumped)

This means that you're using a boost::shared_ptr before it's initialized somewhere.

ChernoA commented 4 years ago

Hello @anshulpaigwar

I made some improvements to usability and error-handling.
Please try the latest changes:
http://github.com/ChernoA/nuscenes2bag

.

Your error message was actually two errors:

Could not find file ... foo.pcd
This happened because it tries to load the 'samples' and 'sweeps' from the wrong directory.
Previously I suggest to make symlinks.
But now I improve the nuscenes2bag tool so it defaults to "v1.0-mini" dataset, whilst also giving you the option to use a different dataset version.

So there are two arguments:
--dataroot (required) Previously named 'sample_dir'
--version (optional) e.g. "v1.0-mini" or "v2.0" which match the argument names in the python devkit:
http://github.com/nutonomy/nuscenes-devkit/blob/master/python-sdk/nuscenes/nuscenes.py

Assertion px != 0 This was a bug in my back-port.
If the file is not found, it still tried to do something with a null ptr. So I fix that so the msg.frame_id field is only set after checking for a valid ptr.

ChernoA commented 4 years ago

@clynamen This PR was supposed to be for "minor suggestions" which is only the commits made on September 24:

commit 1483f179790a0bc5e0463b8a975afee7d80344b0

    Fix minimum Boost version

commit 22d9ec54987163ba8d9671d944a26a96edcde107

    Specify Cpp17 in CMakeLists

commit 0ef1451a3c104d520dd40f601831a89fe567e496

    Fix PCL dependency

commit 13a5013e6fd775aff47ee031016334fec5d5db75

    Remove old way to specific Cpp version

commit 5fc1382212c14049607027bf66493b9a45e968c0

    Don't explicitly link to std::filesystem

commit 9b5eecfc26f8a854273146f3bc05521a792c3f5c

    Fix tab/space

commit 7081453fa9d2b8d15236e205daefecc10f5101c2

    Add usage examples to README

However github decided to update this PR with my newer fixes. So you could either cherry-pick the commits from September 24, or I can try to fix this PR if it helps you?

anshulpaigwar commented 4 years ago

@ChernoA after the new update everything works perfectly! Thanks.

clynamen commented 4 years ago

Hello @ChernoA, thanks for the big code update.

Unfortunately, I had no time till today for maintaining this project, but luckily I will be able to do this during these weeks. I will also try to add the new features requested elsewhere.

But first, I am going to merge this ;)