From fbd52b28fcf89639b73201814e469c30581b6dd1 Mon Sep 17 00:00:00 2001 From: Nairen Fu Date: Mon, 12 Jul 2021 13:34:51 -0500 Subject: [PATCH] Changed const to constexpr. --- reflex_driver/src/reflex_hand.h | 6 +++--- reflex_driver2/src/reflex_hand.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/reflex_driver/src/reflex_hand.h b/reflex_driver/src/reflex_hand.h index b37a871..402ff6f 100644 --- a/reflex_driver/src/reflex_hand.h +++ b/reflex_driver/src/reflex_hand.h @@ -54,9 +54,9 @@ namespace reflex_hand static const uint16_t DYN_MIN_RAW = 0; static const uint16_t DYN_MAX_RAW = 4095; static const uint16_t DYN_MIN_RAW_WRAPPED = 16383; // For checking negative wraps - static const float DYN_POS_SCALE = (4 * 2 * 3.141596) / 4095; // Assuming resolution divider of 4 - static const float DYN_VEL_SCALE = 0.01194; // rad/s for every velocity command -- http://support.robotis.com/en/product/dynamixel/mx_series/mx-28.htm#Actuator_Address_20 - static const float ENC_SCALE = (2 * 3.141596) / 16383; + static constexpr float DYN_POS_SCALE = (4 * 2 * 3.141596) / 4095; // Assuming resolution divider of 4 + static constexpr float DYN_VEL_SCALE = 0.01194; // rad/s for every velocity command -- http://support.robotis.com/en/product/dynamixel/mx_series/mx-28.htm#Actuator_Address_20 + static constexpr float ENC_SCALE = (2 * 3.141596) / 16383; enum ControlMode{CM_IDLE = 0, CM_VELOCITY = 1, CM_POSITION = 2}; typedef boost::function StateCallback; diff --git a/reflex_driver2/src/reflex_hand.h b/reflex_driver2/src/reflex_hand.h index cc27f54..8f7cd84 100644 --- a/reflex_driver2/src/reflex_hand.h +++ b/reflex_driver2/src/reflex_hand.h @@ -72,15 +72,15 @@ namespace reflex_hand static const uint16_t DYN_MIN_RAW_WRAPPED = 16383; // Assuming resolution divider of 4 - static const float DYN_POS_SCALE = (4 * 2 * 3.141596) / 4095; + static constexpr float DYN_POS_SCALE = (4 * 2 * 3.141596) / 4095; /* rad/s for every velocity command -- http://support.robotis.com/en/product/dynamixel /mx_series/mx-28.htm#Actuator_Address_20 */ - static const float DYN_VEL_SCALE = 0.01194; - static const float ENC_SCALE = (2 * 3.141596) / 16383; + static constexpr float DYN_VEL_SCALE = 0.01194; + static constexpr float ENC_SCALE = (2 * 3.141596) / 16383; enum ControlMode{ CM_IDLE = 0, CM_VELOCITY = 1, @@ -116,4 +116,4 @@ namespace reflex_hand }; } -#endif \ No newline at end of file +#endif