11#include <RobotsIO/Utils/DatasetSpatialVelocity.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_DatasetSpatialVelocity";
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 linear_velocity = dataset.linear_velocity_origin();
47 auto angular_velocity = dataset.angular_velocity();
48 std::cout << i++ <<
": "
49 << linear_velocity.transpose() <<
" "
50 << angular_velocity.transpose() <<
" "
51 <<
"(degenerate: " << (dataset.is_screw_degenerate() ?
"true" :
"false") <<
") "
59bool parse_size_t (
char** argv,
const std::size_t& index,
const std::string& name, std::size_t& retrieved)
63 if (std::stoi(argv[index]) < 0)
64 throw(std::invalid_argument(
""));
65 retrieved = std::stoul(argv[index]);
67 catch (std::invalid_argument)
69 std::cerr <<
"Invalid value " << argv[index] <<
" for parameter <" << name <<
">." << std::endl;