@@ -77,13 +77,13 @@ void ControlNode::control_loop_callback()
7777 const vec3f acc = controller_->compute_acceleration (velocity, target_path_, speed_profile_->speeds .at (0 ));
7878
7979 // ALY'S FAVOURITE DEBUG CMD 1
80- RCLCPP_INFO_THROTTLE (this ->get_logger (), *this ->get_clock (), 700 , " ACC: %.2f, %.2f, %.2f" , acc.x , acc.y , acc.z );
80+ // RCLCPP_INFO_THROTTLE(this->get_logger(), *this->get_clock(), 700, "ACC: %.2f, %.2f, %.2f", acc.x, acc.y, acc.z);
8181
8282 // compute acc and throttle using ackermann controller
8383 AckermannController::Command cmd = ackermann_controller_.compute_command (acc, velocity);
8484
8585 // ALY'S FAVOURITE DEBUG CMD 2
86- RCLCPP_INFO_THROTTLE (this ->get_logger (), *this ->get_clock (), 700 , " CMD: {throttle: %.2f, steering: %.2f}" , cmd.throttle , cmd.steering );
86+ // RCLCPP_INFO_THROTTLE(this->get_logger(), *this->get_clock(), 700, "CMD: {throttle: %.2f, steering: %.2f}", cmd.throttle, cmd.steering);
8787
8888 // pack the turn angle into a message
8989 FloatStamped turn_msg;
@@ -95,9 +95,15 @@ void ControlNode::control_loop_callback()
9595 pwr_msg.header .stamp = this ->now ();
9696 pwr_msg.value = cmd.throttle ; // [-1, 1]
9797
98- // send both messages out
98+ // pack the brake into a message
99+ FloatStamped brake_msg;
100+ brake_msg.header .stamp = this ->now ();
101+ brake_msg.value = cmd.brake ;
102+
103+ // send all messages out
99104 turning_angle_pub_->publish (turn_msg);
100105 motor_power_pub_->publish (pwr_msg);
106+ brake_pub_->publish (brake_msg);
101107}
102108
103109ControlNode::ControlNode (const std::string& cfg_path, float rate_hz)
@@ -121,6 +127,7 @@ ControlNode::ControlNode(const std::string& cfg_path, float rate_hz)
121127 // Pubs
122128 turning_angle_pub_ = this ->create_publisher <FloatStamped>(" /ap1/control/turn_angle" , 1 );
123129 motor_power_pub_ = this ->create_publisher <FloatStamped>(" /ap1/control/motor_power" , 1 );
130+ brake_pub_ = this ->create_publisher <FloatStamped>(" /ap1/control/brake" , 1 );
124131
125132 // Create Control Loop
126133 timer_ = this ->create_wall_timer (std::chrono::duration<double >(1.0 / rate_hz),
0 commit comments