src
utils
yaw2quaternion.cpp
Go to the documentation of this file.
1
7
/*****************************************************************************
8
** Includes
9
*****************************************************************************/
10
11
#include <iostream>
12
#include <
ecl/command_line.hpp
>
13
#include <
ecl/linear_algebra.hpp
>
14
15
/*****************************************************************************
16
* Using
17
****************************************************************************/
18
19
using
ecl::ArgException
;
20
using
ecl::CmdLine
;
21
using
ecl::UnlabeledValueArg
;
22
23
/*****************************************************************************
24
** Main program
25
*****************************************************************************/
26
int
main
(
int
argc,
char
** argv) {
27
28
/******************************************
29
* Parse for the port name
30
******************************************/
31
bool
hex(
false
);
32
double
yaw;
33
34
try
{
35
CmdLine
cmd(
"Calculator for yaw to quaternion."
,
' '
,
"0.1"
);
36
UnlabeledValueArg<double>
arg_yaw(
"yaw"
,
"Yaw angle to convert"
,
true
,0.0,
"float"
, cmd);
37
cmd.
parse
(argc,argv);
38
yaw = arg_yaw.
getValue
();
39
}
catch
(
ArgException
&e ) {
40
std::cerr <<
"error: "
<< e.
error
() <<
" for arg "
<< e.
argId
() << std::endl;
41
}
42
Eigen::Quaternion<double> q;
43
q = Eigen::AngleAxis<double>(yaw, Eigen::Vector3d::UnitZ());
44
std::cout <<
"Quaternion: [x: "
<< q.x() <<
" y: "
<< q.y() <<
" z: "
<< q.z() <<
" w: "
<< q.w() <<
"]"
<< std::endl;
45
46
return
0;
47
}
main
int main(int argc, char **argv)
Definition:
yaw2quaternion.cpp:26
command_line.hpp
ecl::CmdLine
linear_algebra.hpp
ecl::ValueArg::getValue
T & getValue()
ecl::ArgException
ecl::UnlabeledValueArg
ecl::ArgException::argId
std::string argId() const
ecl::ArgException::error
std::string error() const
ecl::CmdLine::parse
void parse(int argc, char **argv)
ecl_core_apps
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:52