Skip to content

Commit 3e42f4b

Browse files
committed
remove debugging prints & code
1 parent 2ee9e06 commit 3e42f4b

File tree

2 files changed

+0
-57
lines changed

2 files changed

+0
-57
lines changed

nav2_mppi_controller/include/nav2_mppi_controller/optimizer.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ class Optimizer
145145
*/
146146
void optimize();
147147

148-
void computeControlSequenceAccel(const models::ControlSequence& control_sequence);
149-
150148
/**
151149
* @brief Prepare state information on new request for trajectory rollouts
152150
* @param robot_pose Pose of the robot at given time
@@ -282,8 +280,6 @@ class Optimizer
282280
models::Path path_;
283281
geometry_msgs::msg::Pose goal_;
284282
Eigen::ArrayXf costs_;
285-
geometry_msgs::msg::TwistStamped prev_control_twist_;
286-
models::ControlSequence prev_control_sequence_;
287283
Eigen::Array3f initial_velocities_;
288284

289285
CriticData critics_data_ = {

nav2_mppi_controller/src/optimizer.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -216,61 +216,9 @@ std::tuple<geometry_msgs::msg::TwistStamped, Eigen::ArrayXXf> Optimizer::evalCon
216216
shiftControlSequence();
217217
}
218218

219-
{
220-
auto & s = settings_;
221-
constexpr float epsilon = 1e-4f;
222-
223-
// Check if accelerations exceed constraints
224-
double dt = (control.header.stamp.sec - prev_control_twist_.header.stamp.sec)
225-
+ 1e-9 * (control.header.stamp.nanosec - prev_control_twist_.header.stamp.nanosec);
226-
227-
float ax = (control.twist.linear.x - prev_control_twist_.twist.linear.x) / s.model_dt;
228-
float ax_real = (control.twist.linear.x - prev_control_twist_.twist.linear.x) / dt;
229-
if (std::abs(ax) > s.constraints.ax_max + epsilon) {
230-
std::cout << "Acceleration constraint violated from last command " << ":\t";
231-
std::cout << "vx[i]: " << control.twist.linear.x << ", vx[i-1]: " << prev_control_twist_.twist.linear.x
232-
<< ", ax: " << ax << " real dt: " << dt << " real ax " << ax_real << "\n" ;
233-
}
234-
float wz = (control.twist.angular.z - prev_control_twist_.twist.angular.z) / s.model_dt;
235-
float wz_real = (control.twist.angular.z - prev_control_twist_.twist.angular.z) / dt;
236-
if (std::abs(wz) > s.constraints.az_max + epsilon) {
237-
std::cout << "Angular Acceleration constraint violated from last command " << ":\t";
238-
std::cout << "wz[i]: " << control.twist.angular.z << ", wz[i-1]: " << prev_control_twist_.twist.angular.z
239-
<< ", az: " << wz << " real dt: " << dt << " real az " << wz_real << "\n" ;
240-
}
241-
}
242-
243-
prev_control_twist_ = control;
244-
prev_control_sequence_ = control_sequence_;
245-
246219
return std::make_tuple(control, optimal_trajectory);
247220
}
248221

249-
void Optimizer::computeControlSequenceAccel(const models::ControlSequence& control_sequence)
250-
{
251-
auto & s = settings_;
252-
253-
std::cout << std::endl;
254-
for (long int i = 1; i < control_sequence.vx.size(); ++i) {
255-
constexpr float epsilon = 1e-4f;
256-
257-
// Check if accelerations exceed constraints
258-
float ax = (control_sequence.vx(i) - control_sequence.vx(i - 1)) / s.model_dt;
259-
if (std::abs(ax) > s.constraints.ax_max + epsilon) {
260-
std::cout << "****Acceleration constraint violated at index " << i << ":\n";
261-
std::cout << "vx[i-1]: " << control_sequence.vx(i - 1) << ", vx[i]: " << control_sequence.vx(i) << ", ax: " << ax << "\n";
262-
}
263-
264-
float wz_accel = (control_sequence.wz(i) - control_sequence.wz(i - 1)) / s.model_dt;
265-
if (std::abs(wz_accel) > s.constraints.az_max + epsilon) {
266-
std::cout << "***Angular acceleration constraint violated at index " << i << ":\n";
267-
std::cout << "wz[i-1]: " << control_sequence.wz(i - 1) << ", wz[i]: " << control_sequence.wz(i) << ", wz_accel: " << wz_accel << "\n";
268-
}
269-
}
270-
std::cout << std::endl;
271-
}
272-
273-
274222
void Optimizer::optimize()
275223
{
276224
for (size_t i = 0; i < settings_.iteration_count; ++i) {
@@ -571,7 +519,6 @@ void Optimizer::updateControlSequence()
571519
}
572520

573521
utils::savitskyGolayFilter(control_sequence_, control_history_, settings_);
574-
control_sequence_virtual_ = control_sequence_;
575522

576523
applyControlSequenceConstraints();
577524
}

0 commit comments

Comments
 (0)