small changes to IO
This commit is contained in:
parent
532809e1cf
commit
fc0683f65f
|
@ -150,8 +150,7 @@ typedef std::shared_ptr<DatasetIoInterface> DatasetIoInterfacePtr;
|
||||||
|
|
||||||
class DatasetIoFactory {
|
class DatasetIoFactory {
|
||||||
public:
|
public:
|
||||||
static DatasetIoInterfacePtr getDatasetIo(const std::string &dataset_type,
|
static DatasetIoInterfacePtr getDatasetIo(const std::string &dataset_type);
|
||||||
bool with_images = true);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace basalt
|
} // namespace basalt
|
||||||
|
|
|
@ -165,7 +165,7 @@ class RosbagVioDataset : public VioDataset {
|
||||||
|
|
||||||
class RosbagIO : public DatasetIoInterface {
|
class RosbagIO : public DatasetIoInterface {
|
||||||
public:
|
public:
|
||||||
RosbagIO(bool with_images) : with_images(with_images) {}
|
RosbagIO() {}
|
||||||
|
|
||||||
void read(const std::string &path) {
|
void read(const std::string &path) {
|
||||||
if (!fs::exists(path))
|
if (!fs::exists(path))
|
||||||
|
@ -176,13 +176,7 @@ class RosbagIO : public DatasetIoInterface {
|
||||||
data->bag.reset(new rosbag::Bag);
|
data->bag.reset(new rosbag::Bag);
|
||||||
data->bag->open(path, rosbag::bagmode::Read);
|
data->bag->open(path, rosbag::bagmode::Read);
|
||||||
|
|
||||||
rosbag::View view(*data->bag, [this](const rosbag::ConnectionInfo *ci) {
|
rosbag::View view(*data->bag);
|
||||||
if (this->with_images)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return ci->datatype == std::string("sensor_msgs/Imu") ||
|
|
||||||
ci->datatype == std::string("geometry_msgs/TransformStamped");
|
|
||||||
});
|
|
||||||
|
|
||||||
// get topics
|
// get topics
|
||||||
std::vector<const rosbag::ConnectionInfo *> connection_infos =
|
std::vector<const rosbag::ConnectionInfo *> connection_infos =
|
||||||
|
@ -405,8 +399,6 @@ class RosbagIO : public DatasetIoInterface {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<RosbagVioDataset> data;
|
std::shared_ptr<RosbagVioDataset> data;
|
||||||
|
|
||||||
bool with_images;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace basalt
|
} // namespace basalt
|
||||||
|
|
|
@ -306,7 +306,6 @@ class UzhIO : public DatasetIoInterface {
|
||||||
q.z() >> q.w();
|
q.z() >> q.w();
|
||||||
|
|
||||||
int64_t t_ns = timestamp * 1e9;
|
int64_t t_ns = timestamp * 1e9;
|
||||||
t_ns += -99902802;
|
|
||||||
|
|
||||||
data->gt_timestamps.emplace_back(t_ns);
|
data->gt_timestamps.emplace_back(t_ns);
|
||||||
data->gt_pose_data.emplace_back(q, pos);
|
data->gt_pose_data.emplace_back(q, pos);
|
||||||
|
|
|
@ -41,12 +41,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace basalt {
|
namespace basalt {
|
||||||
|
|
||||||
DatasetIoInterfacePtr DatasetIoFactory::getDatasetIo(
|
DatasetIoInterfacePtr DatasetIoFactory::getDatasetIo(
|
||||||
const std::string &dataset_type, bool with_images) {
|
const std::string &dataset_type) {
|
||||||
if (dataset_type == "euroc") {
|
if (dataset_type == "euroc") {
|
||||||
// return DatasetIoInterfacePtr();
|
// return DatasetIoInterfacePtr();
|
||||||
return DatasetIoInterfacePtr(new EurocIO);
|
return DatasetIoInterfacePtr(new EurocIO);
|
||||||
} else if (dataset_type == "bag") {
|
} else if (dataset_type == "bag") {
|
||||||
return DatasetIoInterfacePtr(new RosbagIO(with_images));
|
return DatasetIoInterfacePtr(new RosbagIO);
|
||||||
} else if (dataset_type == "uzh") {
|
} else if (dataset_type == "uzh") {
|
||||||
return DatasetIoInterfacePtr(new UzhIO);
|
return DatasetIoInterfacePtr(new UzhIO);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue