types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, The Regents of the University of California (Regents).
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following
14  * disclaimer in the documentation and/or other materials provided
15  * with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Please contact the author(s) of this library if you have any questions.
34  * Authors: David Fridovich-Keil ( dfk@eecs.berkeley.edu )
35  */
36 
38 //
39 // Custom types.
40 //
42 
43 #ifndef FASTRACK_UTILS_TYPES_H
44 #define FASTRACK_UTILS_TYPES_H
45 
46 // ------------------------------- INCLUDES -------------------------------- //
47 
48 #include <Eigen/Dense>
49 #include <Eigen/Geometry>
50 #include <algorithm>
51 #include <exception>
52 #include <iostream>
53 #include <limits>
54 #include <math.h>
55 #include <memory>
56 #include <random>
57 #include <string>
58 #include <type_traits>
59 #include <typeinfo>
60 #include <vector>
61 
62 // ------------------------------- CONSTANTS -------------------------------- //
63 
64 namespace fastrack {
65 namespace constants {
66 // Acceleration due to gravity.
67 static constexpr double G = 9.81;
68 
69 // Small number for use in approximate equality checking.
70 static constexpr double kEpsilon = 1e-4;
71 
72 // Double precision infinity.
73 static constexpr double kInfinity = std::numeric_limits<double>::infinity();
74 
75 // Default speed of 1 m/s.
76 static constexpr double kDefaultSpeed = 1.0;
77 
78 // Default height (e.g. for planar state space models).
79 static constexpr double kDefaultHeight = 1.0;
80 } // namespace constants
81 
82 // Empty struct for setting unused/unimplemented template args.
83 struct Empty {};
84 } // namespace fastrack
85 
86 // ---------------------------- SIMPLE FUNCTIONS ---------------------------- //
87 
88 template <typename T, typename... Args>
89 std::unique_ptr<T> make_unique(Args &&... args) {
90  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
91 }
92 
93 // ------------------------ THIRD PARTY TYPEDEFS ---------------------------- //
94 
95 using Eigen::Matrix3d;
96 using Eigen::Matrix4d;
97 using Eigen::MatrixXd;
98 using Eigen::Quaterniond;
99 using Eigen::Vector3d;
100 using Eigen::VectorXd;
101 
102 #endif
static constexpr double kDefaultHeight
Definition: types.h:79
static constexpr double kDefaultSpeed
Definition: types.h:76
static constexpr double kEpsilon
Definition: types.h:70
Definition: box.h:53
std::unique_ptr< T > make_unique(Args &&...args)
Definition: types.h:89
static constexpr double G
Definition: types.h:67
static constexpr double kInfinity
Definition: types.h:73


fastrack
Author(s): David Fridovich-Keil
autogenerated on Mon Aug 3 2020 21:28:37