Go to the documentation of this file.
38 #ifndef WIN32_LEAN_AND_MEAN
39 #define WIN32_LEAN_AND_MEAN 1
58 #include <MultiSense/MultiSenseChannel.hh>
66 volatile bool doneG =
false;
68 void usage(
const char *programNameP)
70 std::cerr <<
"USAGE: " << programNameP <<
" [<options>]" << std::endl;
71 std::cerr <<
"Where <options> are:" << std::endl;
72 std::cerr <<
"\t-a <ip_address> : IPV4 address (default=10.66.171.21)" << std::endl;
73 std::cerr <<
"\t-m <mtu> : default=1500" << std::endl;
74 std::cerr <<
"\t-f <log_file> : FILE to log IMU data (stdout by default)" << std::endl;
80 BOOL WINAPI signalHandler(DWORD dwCtrlType)
83 std::cerr <<
"Shutting down on signal: CTRL-C" << std::endl;
88 void signalHandler(
int sig)
90 std::cerr <<
"Shutting down on signal: " << strsignal(sig) << std::endl;
99 std::cout <<
"----------------------------" << std::endl;
100 std::cout <<
"frameId: " <<
header.frameId << std::endl;
101 std::cout <<
"timestamp: " <<
header.timestamp << std::endl;
102 std::cout <<
"imageSource: " <<
header.imageSource << std::endl;
103 std::cout <<
"success: " << (
header.success ?
"true" :
"false") << std::endl;
104 std::cout <<
"numDetections: " <<
header.numDetections << std::endl;
106 for (
auto &d :
header.detections)
108 std::cout <<
"tag ID: " <<
d.id <<
", family ID: " <<
d.family << std::endl;
109 std::cout <<
"\thamming: " << (
int)
d.hamming << std::endl;
110 std::cout <<
"\tdecisionMargin: " <<
d.decisionMargin << std::endl;
112 std::cout <<
"\ttagToImageHomography: " << std::endl;
113 for (
unsigned int col = 0; col < 3; col++)
116 for (
unsigned int row = 0; row < 3; row++)
118 std::cout <<
d.tagToImageHomography[row][col] <<
" ";
120 std::cout << std::endl;
123 std::cout <<
"\tcenter: " << std::endl;
124 for (
unsigned int i = 0; i < 2; i++)
125 std::cout <<
"\t\t" <<
d.center[i] << std::endl;
127 std::cout <<
"\tcorners: " << std::endl;
128 for (
unsigned int i = 0; i < 4; i++)
129 std::cout <<
"\t\t" <<
d.corners[i][0] <<
" " <<
d.corners[i][1] << std::endl;
138 std::string currentAddress =
"10.66.171.21";
143 bool apriltag_supported =
false;
144 std::vector<system::DeviceMode> deviceModes;
148 SetConsoleCtrlHandler (signalHandler, TRUE);
150 signal(SIGINT, signalHandler);
158 while(-1 != (c =
getopt(argc, argvPP,
"a:m:v")))
160 case 'a': currentAddress = std::string(
optarg);
break;
161 case 'm': mtu = atoi(
optarg);
break;
162 default:
usage(*argvPP);
break;
169 if (NULL == channelP) {
170 std::cerr <<
"Failed to establish communications with \"" << currentAddress <<
"\"" << std::endl;
195 std::any_of(deviceModes.begin(), deviceModes.end(), [](
const auto &mode) {
196 return mode.supportedDataSources & Source_AprilTag_Detections; });
198 if (!apriltag_supported) {
199 std::cerr <<
"AprilTag detector not supported with this firmware" << std::endl;
215 status = channelP->
setMtu(mtu);
228 std::cerr <<
"Reconfigure: failed to query image config: " <<
Channel::statusString(status) << std::endl;
237 std::cerr <<
"Reconfigure: failed to set image config: " <<
Channel::statusString(status) << std::endl;
static CRL_CONSTEXPR Status Status_Ok
static CRL_CONSTEXPR DataSource Source_AprilTag_Detections
int getopt(int argc, char **argv, char *opts)
static void Destroy(Channel *instanceP)
virtual Status setApriltagParams(const system::ApriltagParams ¶ms)=0
int main(int argc, char **argvPP)
virtual Status startStreams(DataSource mask)=0
virtual Status setMtu(int32_t mtu)=0
static CRL_CONSTEXPR CameraProfile User_Control
static CRL_CONSTEXPR CameraProfile AprilTag
static const char * statusString(Status status)
static CRL_CONSTEXPR DataSource Source_All
virtual Status setBestMtu()=0
static Channel * Create(const std::string &sensorAddress)
virtual Status getImageConfig(image::Config &c)=0
virtual Status getVersionInfo(system::VersionInfo &v)=0
std_msgs::Header const * header(const M &m)
virtual Status getDeviceModes(std::vector< system::DeviceMode > &m)=0
virtual Status addIsolatedCallback(image::Callback callback, DataSource imageSourceMask, void *userDataP=NULL)=0
virtual Status stopStreams(DataSource mask)=0
void setCameraProfile(const CameraProfile &profile)
virtual Status setImageConfig(const image::Config &c)=0