void throttle_cb(const std_msgs::Float64::ConstPtr &req) { float throttle_normalized = req->data; if (reverse_throttle) if ( throttle_normalized < -1.0 || throttle_normalized > 1.0 ) { ROS_DEBUG_ONCE("Warning: Not normalized values of throttle! Values should be between -1.0 and 1.0"); return; } else send_attitude_throttle(throttle_normalized); else if ( throttle_normalized < 0.0 || throttle_normalized > 1.0 ) { ROS_DEBUG_ONCE("Warning: Not normalized values of throttle! Values should be between 0.0 and 1.0"); return; } else send_attitude_throttle(throttle_normalized); }
void throttle_cb(const std_msgs::Float64::ConstPtr &req) { float throttle_normalized = req->data; // note: && are lazy, is_normalized() should be called only if reverse_throttle are true. if (reverse_throttle && !is_normalized(throttle_normalized, -1.0, 1.0)) return; else if (!is_normalized(throttle_normalized, 0.0, 1.0)) return; send_attitude_throttle(throttle_normalized); }