diff --git a/MantleAPI/include/MantleAPI/Common/orientation.h b/MantleAPI/include/MantleAPI/Common/orientation.h index e52df4ad55a1bdbf862a7a2635716fd44a037a26..b64b1fb635dc375cfeee944bed728c44451ad108 100644 --- a/MantleAPI/include/MantleAPI/Common/orientation.h +++ b/MantleAPI/include/MantleAPI/Common/orientation.h @@ -33,6 +33,19 @@ typedef base_unit<detail::meter_ratio<0>, std::ratio<0>, std::ratio<-2>, std::ra UNIT_ADD_CATEGORY_TRAIT(angular_acceleration) +UNIT_ADD(angular_jerk, + radians_per_second_cubed, + radians_per_second_cubed, + rad_per_s_cu, + compound_unit<angle::radians, inverse<cubed<time::seconds>>>) + +namespace category +{ +typedef base_unit<detail::meter_ratio<0>, std::ratio<0>, std::ratio<-3>, std::ratio<1>> angular_jerk_unit; +} + +UNIT_ADD_CATEGORY_TRAIT(angular_jerk) + } // namespace units namespace mantle_api diff --git a/MantleAPI/include/MantleAPI/Common/spline.h b/MantleAPI/include/MantleAPI/Common/spline.h index 32c97bc9d17b0624d7819acc84ad954968a6f203..7b91677af2b591ced85808bd0f3bab2f1d7648db 100644 --- a/MantleAPI/include/MantleAPI/Common/spline.h +++ b/MantleAPI/include/MantleAPI/Common/spline.h @@ -17,6 +17,7 @@ #define MANTLEAPI_COMMON_SPLINE_H #include <MantleAPI/Common/floating_point_helper.h> +#include <MantleAPI/Common/orientation.h> #include <MantleAPI/Common/time_utils.h> #include <MantleAPI/Common/vector.h> #include <units.h> @@ -25,6 +26,36 @@ using namespace units; +namespace units +{ +UNIT_ADD(jerk, + meters_per_second_cubed, + meters_per_second_cubed, + mps_cu, + compound_unit<velocity::meters_per_second, inverse<squared<time::seconds>>>) + +namespace category +{ +typedef base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-3>> jerk_unit; +} + +UNIT_ADD_CATEGORY_TRAIT(jerk) + +UNIT_ADD(jerk_acceleration, + meters_per_second_to_the_power_of_four, + meters_per_second_to_the_power_of_four, + mps_pow4, + compound_unit<velocity::meters_per_second, inverse<cubed<time::seconds>>>) + +namespace category +{ +typedef base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-4>> jerk_acceleration_unit; +} + +UNIT_ADD_CATEGORY_TRAIT(jerk_acceleration) + +} // namespace units + namespace mantle_api { template <typename T> diff --git a/MantleAPI/include/MantleAPI/Common/time_utils.h b/MantleAPI/include/MantleAPI/Common/time_utils.h index e870485a76b717aaf3bffb8ec4ca56a843bd59c9..6d4ac464fa73d96867d13529b947534bdb96776b 100644 --- a/MantleAPI/include/MantleAPI/Common/time_utils.h +++ b/MantleAPI/include/MantleAPI/Common/time_utils.h @@ -22,13 +22,11 @@ namespace mantle_api using Time = units::time::millisecond_t; /// @brief Converts input in [s] to @ref Time. -/// @tparam T Input type, eg. `double`. /// @param duration Input value /// @return Duration representing the given input in units of @ref Time. -template <typename T> -inline Time SecondsToTime(T duration) +inline Time SecondsToTime(double duration) { - return units::convert<units::time::seconds, Time>(duration); + return units::time::second_t(duration); } /// @brief Converts input @ref Time to [s].