NASA Astrobee Robot Software  Astrobee Version:
Flight software for the Astrobee robots operating inside the International Space Station.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
conversions.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef TRAJ_OPT_PRO_CONVERSIONS_H_
20 #define TRAJ_OPT_PRO_CONVERSIONS_H_
21 
22 #include <geometry_msgs/Point.h>
23 #include <geometry_msgs/Vector3.h>
24 #include <traj_opt_basic/types.h>
25 
26 namespace traj_opt {
27 class Conversions {
28  public:
29  // Conversions() {}
30  static Vec4 PointToVec(const geometry_msgs::Point &p) {
31  Vec4 v;
32  v << p.x, p.y, p.z, 0.0;
33  return v;
34  }
35  static geometry_msgs::Point VecToPoint(const Vec4 &v) {
36  geometry_msgs::Point p;
37  p.x = v(0);
38  p.y = v(1);
39  p.z = v(2);
40  return p;
41  }
42  static Vec4 Vector3ToVec(const geometry_msgs::Vector3 &p) {
43  Vec4 v;
44  v << p.x, p.y, p.z, 0.0;
45  return v;
46  }
47  static geometry_msgs::Vector3 VecToVector3(const Vec4 &v) {
48  geometry_msgs::Vector3 p;
49  p.x = v(0);
50  p.y = v(1);
51  p.z = v(2);
52  return p;
53  }
54 };
55 } // namespace traj_opt
56 #endif // TRAJ_OPT_PRO_CONVERSIONS_H_
types.h
traj_opt::Conversions
Definition: conversions.h:27
traj_opt::Conversions::PointToVec
static Vec4 PointToVec(const geometry_msgs::Point &p)
Definition: conversions.h:30
traj_opt::Conversions::VecToPoint
static geometry_msgs::Point VecToPoint(const Vec4 &v)
Definition: conversions.h:35
traj_opt
Definition: msg_traj.h:27
traj_opt::Vec4
Eigen::Matrix< decimal_t, 4, 1 > Vec4
Definition: types.h:41
traj_opt::Conversions::Vector3ToVec
static Vec4 Vector3ToVec(const geometry_msgs::Vector3 &p)
Definition: conversions.h:42
traj_opt::Conversions::VecToVector3
static geometry_msgs::Vector3 VecToVector3(const Vec4 &v)
Definition: conversions.h:47