11#include <RobotsIO/Utils/DatasetTransform.h>
14using namespace RobotsIO::Utils;
17bool parse_size_t (
char** argv,
const std::size_t& index,
const std::string& name, std::size_t& retrieved);
20int main(
int argc,
char** argv)
22 const std::string log_name =
"test_DatasetTransform";
26 std::cerr <<
"Synopsis: " + log_name +
" <dataset_path> <skip_rows> <skip_cols>" << std::endl << std::endl;
31 const std::string dataset_path{argv[1]};
33 std::size_t skip_rows;
34 if (!parse_size_t(argv, 2,
"skip_rows", skip_rows))
37 std::size_t skip_cols;
38 if (!parse_size_t(argv, 3,
"skip_cols", skip_cols))
44 while (dataset.freeze())
46 auto transform = dataset.transform();
47 auto rotation = AngleAxisd(transform.rotation());
48 std::cout << i++ <<
": "
49 << transform.translation().transpose() <<
" "
50 << rotation.axis().transpose() <<
" " << rotation.angle()
58bool parse_size_t (
char** argv,
const std::size_t& index,
const std::string& name, std::size_t& retrieved)
62 if (std::stoi(argv[index]) < 0)
63 throw(std::invalid_argument(
""));
64 retrieved = std::stoul(argv[index]);
66 catch (std::invalid_argument)
68 std::cerr <<
"Invalid value " << argv[index] <<
" for parameter <" << name <<
">." << std::endl;