Apollo 11.0
自动驾驶开放平台
quaternion_euler.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#include "gflags/gflags.h"
18
19#include "cyber/common/log.h"
22
23DEFINE_double(qx, 0, "quaternion x");
24DEFINE_double(qy, 0, "quaternion y");
25DEFINE_double(qz, 0, "quaternion z");
26DEFINE_double(qw, 0, "quaternion w");
27
28int main(int32_t argc, char** argv) {
29 google::InitGoogleLogging(argv[0]);
30 FLAGS_alsologtostderr = true;
31 FLAGS_v = 3;
32
33 google::ParseCommandLineFlags(&argc, &argv, true);
34
35 apollo::common::math::EulerAnglesZXY<double> euler(FLAGS_qw, FLAGS_qx,
36 FLAGS_qy, FLAGS_qz);
37 AINFO << "roll: " << euler.roll() << " pitch:" << euler.pitch()
38 << " yaw:" << euler.yaw();
39 AINFO << "heading: "
41 FLAGS_qy, FLAGS_qz)
42 << " heading degree: "
43 << 180.0 / M_PI *
45 FLAGS_qy, FLAGS_qz);
46}
Any orientation of a rigid body on a 3-D space can be achieved by composing three rotations about the...
Defines the EulerAnglesZXY class.
#define AINFO
Definition log.h:42
double QuaternionToHeading(const double qw, const double qx, const double qy, const double qz)
Definition quaternion.h:56
Contains a number of helper functions related to quaternions.
DEFINE_double(qx, 0, "quaternion x")
int main(int32_t argc, char **argv)