1 #ifndef MODE_TARGET_HELPER_HPP
2 #define MODE_TARGET_HELPER_HPP
5 #include <boost/numeric/conversion/cast.hpp>
22 std::atomic<bool> has_target_;
33 RCLCPP_DEBUG(rclcpp::get_logger(
"canopen_402_target"),
"Target command is not a number");
37 using boost::numeric_cast;
38 using boost::numeric::negative_overflow;
39 using boost::numeric::positive_overflow;
43 target_ = numeric_cast<T>(val);
45 catch (negative_overflow &)
47 std::cout <<
"canopen_402 Command " << val
48 <<
" does not fit into target, clamping to min limit" << std::endl;
49 target_ = std::numeric_limits<T>::min();
51 catch (positive_overflow &)
53 std::cout <<
"canopen_402 Command " << val
54 <<
" does not fit into target, clamping to max limit" << std::endl;
55 target_ = std::numeric_limits<T>::max();
59 std::cout <<
"canopen_402 Was not able to cast command " << val << std::endl;
Definition: mode_target_helper.hpp:20
virtual bool setTarget(const double &val)
Definition: mode_target_helper.hpp:28
virtual bool start()
Definition: mode_target_helper.hpp:66
bool hasTarget()
Definition: mode_target_helper.hpp:26
T getTarget()
Definition: mode_target_helper.hpp:27
ModeTargetHelper(uint16_t mode)
Definition: mode_target_helper.hpp:25
Definition: configuration_manager.hpp:28