In controller and hardware interface implementations, variables are often initialized with quiet_NaN. For example, in Unit 4 of the “ROS2_Control Framework Course”, the command and state values are initialized in the on_init()
method as follows:
hw_states_.resize(info_.joints.size(), std::numeric_limits<double>::quiet_NaN());
hw_commands_.resize(info_.joints.size(), std::numeric_limits<double>::quiet_NaN());
Something similar is done in the on_init
method in Unit 5, and the on_activate
method in unit 7.
Why use quiet_NaN
?