29 #include <boost/date_time/posix_time/posix_time.hpp> 30 #include <boost/filesystem.hpp> 32 #if ROS_AVAILABLE == 1 46 int main(
int argc,
char **argv) {
52 std::string config_path =
"unset_path_to_config.yaml";
54 config_path = argv[1];
57 #if ROS_AVAILABLE == 1 60 auto nh = std::make_shared<ros::NodeHandle>(
"~");
61 nh->param<std::string>(
"config_path", config_path, config_path);
65 auto parser = std::make_shared<ov_core::YamlParser>(config_path);
66 #if ROS_AVAILABLE == 1 67 parser->set_node_handler(nh);
71 std::string verbosity =
"INFO";
72 parser->parse_config(
"verbosity", verbosity);
85 std::vector<double> vec_imutime;
86 std::vector<double> vec_camtime;
87 std::vector<Eigen::Vector3d> vec_am;
88 std::vector<Eigen::Vector3d> vec_wm;
89 std::vector<std::vector<std::vector<std::pair<size_t, Eigen::VectorXf>>>> vec_feats;
96 Eigen::Vector3d wm, am;
99 vec_imutime.push_back(time_imu);
100 vec_am.push_back(am);
101 vec_wm.push_back(wm);
106 std::vector<int> camids;
107 std::vector<std::vector<std::pair<size_t, Eigen::VectorXf>>> feats;
108 bool hascam = sim1.
get_next_cam(time_cam, camids, feats);
110 vec_camtime.push_back(time_cam);
111 vec_feats.push_back(feats);
131 Eigen::Vector3d wm, am;
134 assert(time_imu == vec_imutime.at(ct_imu));
135 assert(wm(0) == vec_wm.at(ct_imu)(0));
136 assert(wm(1) == vec_wm.at(ct_imu)(1));
137 assert(wm(2) == vec_wm.at(ct_imu)(2));
138 assert(am(0) == vec_am.at(ct_imu)(0));
139 assert(am(1) == vec_am.at(ct_imu)(1));
140 assert(am(2) == vec_am.at(ct_imu)(2));
146 std::vector<int> camids;
147 std::vector<std::vector<std::pair<size_t, Eigen::VectorXf>>> feats;
148 bool hascam = sim2.
get_next_cam(time_cam, camids, feats);
150 assert(time_cam == vec_camtime.at(ct_cam));
151 for (
size_t camid = 0; camid < feats.size(); camid++) {
152 for (
size_t i = 0; i < feats.at(camid).size(); i++) {
153 assert(feats.at(camid).at(i).first == vec_feats.at(ct_cam).at(camid).at(i).first);
154 assert(feats.at(camid).at(i).second(0) == vec_feats.at(ct_cam).at(camid).at(i).second(0));
155 assert(feats.at(camid).at(i).second(1) == vec_feats.at(ct_cam).at(camid).at(i).second(1));
163 PRINT_INFO(
"success! they all are the same!\n");
int main(int argc, char **argv)
Extended Kalman Filter estimator.
void print_and_load(const std::shared_ptr< ov_core::YamlParser > &parser=nullptr)
This function will load the non-simulation parameters of the system and print.
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool get_next_imu(double &time_imu, Eigen::Vector3d &wm, Eigen::Vector3d &am)
Gets the next inertial reading if we have one.
bool ok()
Returns if we are actively simulating.
Struct which stores all options needed for state estimation.
static void setPrintLevel(const std::string &level)
void print_and_load_simulation(const std::shared_ptr< ov_core::YamlParser > &parser=nullptr)
This function will load print out all simulated parameters. This allows for visual checking that ever...
bool get_next_cam(double &time_cam, std::vector< int > &camids, std::vector< std::vector< std::pair< size_t, Eigen::VectorXf >>> &feats)
Gets the next inertial reading if we have one.
void signal_callback_handler(int signum)
Master simulator class that generated visual-inertial measurements.