mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
t/cli: Add calib-dump command
This commit is contained in:
parent
7d72b74a68
commit
17a14d5b10
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
cli
|
cli
|
||||||
|
cli_cmd_calibration_dump.c
|
||||||
cli_cmd_lighthouse.c
|
cli_cmd_lighthouse.c
|
||||||
cli_cmd_probe.c
|
cli_cmd_probe.c
|
||||||
cli_cmd_slambatch.c
|
cli_cmd_slambatch.c
|
||||||
|
@ -20,6 +21,10 @@ if(NOT WIN32)
|
||||||
target_sources(cli PRIVATE cli_cmd_calibrate.c)
|
target_sources(cli PRIVATE cli_cmd_calibrate.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(XRT_HAVE_OPENCV)
|
||||||
|
target_link_libraries(cli PRIVATE aux_tracking)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(cli PROPERTIES OUTPUT_NAME monado-cli PREFIX "")
|
set_target_properties(cli PROPERTIES OUTPUT_NAME monado-cli PREFIX "")
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
|
|
48
src/xrt/targets/cli/cli_cmd_calibration_dump.c
Normal file
48
src/xrt/targets/cli/cli_cmd_calibration_dump.c
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright 2019-2023, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
/*!
|
||||||
|
* @file
|
||||||
|
* @brief Loads and dumps a calibration file.
|
||||||
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xrt/xrt_compiler.h"
|
||||||
|
#include "xrt/xrt_config_have.h"
|
||||||
|
|
||||||
|
#include "cli_common.h"
|
||||||
|
|
||||||
|
#ifdef XRT_HAVE_OPENCV
|
||||||
|
#include "tracking/t_tracking.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define P(...) fprintf(stderr, __VA_ARGS__)
|
||||||
|
|
||||||
|
int
|
||||||
|
cli_cmd_calibration_dump(int argc, const char **argv)
|
||||||
|
{
|
||||||
|
#ifdef XRT_HAVE_OPENCV
|
||||||
|
if (argc < 3) {
|
||||||
|
P("Must be given a file path\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *filename = argv[2];
|
||||||
|
|
||||||
|
struct t_stereo_camera_calibration *data = NULL;
|
||||||
|
if (!t_stereo_camera_calibration_load(filename, &data)) {
|
||||||
|
P("Could not load '%s'!\n", filename);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_stereo_camera_calibration_dump(data);
|
||||||
|
t_stereo_camera_calibration_reference(&data, NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
P("Not compiled with XRT_HAVE_OPENCV, so can't load calibration files!\n");
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -17,6 +17,9 @@ extern "C" {
|
||||||
int
|
int
|
||||||
cli_cmd_calibrate(int argc, const char **argv);
|
cli_cmd_calibrate(int argc, const char **argv);
|
||||||
|
|
||||||
|
int
|
||||||
|
cli_cmd_calibration_dump(int argc, const char **argv);
|
||||||
|
|
||||||
int
|
int
|
||||||
cli_cmd_lighthouse(int argc, const char **argv);
|
cli_cmd_lighthouse(int argc, const char **argv);
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,14 @@ cli_print_help(int argc, const char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
P("Monado-CLI 0.0.1\n");
|
P("Monado-CLI 0.0.1\n");
|
||||||
P("Usage: %s command [options]\n", argv[0]);
|
P("Usage: %s command [options] [file]\n", argv[0]);
|
||||||
P("\n");
|
P("\n");
|
||||||
P("Commands:\n");
|
P("Commands:\n");
|
||||||
P(" test - List found devices, for prober testing.\n");
|
P(" test - List found devices, for prober testing.\n");
|
||||||
P(" probe - Just probe and then exit.\n");
|
P(" probe - Just probe and then exit.\n");
|
||||||
P(" lighthouse - Control the power of lighthouses [on|off].\n");
|
P(" lighthouse - Control the power of lighthouses [on|off].\n");
|
||||||
P(" calibrate - Calibrate a camera and save config (not implemented yet).\n");
|
P(" calibrate - Calibrate a camera and save config (not implemented yet).\n");
|
||||||
|
P(" calib-dumb - Load and dump a calibration to stdout.\n");
|
||||||
P(" slambatch - Runs a sequence of EuRoC datasets with the SLAM tracker.\n");
|
P(" slambatch - Runs a sequence of EuRoC datasets with the SLAM tracker.\n");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -54,6 +55,9 @@ main(int argc, const char **argv)
|
||||||
return cli_cmd_calibrate(argc, argv);
|
return cli_cmd_calibrate(argc, argv);
|
||||||
}
|
}
|
||||||
#endif // !XRT_OS_WINDOWS
|
#endif // !XRT_OS_WINDOWS
|
||||||
|
if (strcmp(argv[1], "calib-dump") == 0) {
|
||||||
|
return cli_cmd_calibration_dump(argc, argv);
|
||||||
|
}
|
||||||
if (strcmp(argv[1], "lighthouse") == 0) {
|
if (strcmp(argv[1], "lighthouse") == 0) {
|
||||||
return cli_cmd_lighthouse(argc, argv);
|
return cli_cmd_lighthouse(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue