Fix bad vector indexing

This commit is contained in:
2023-02-09 10:55:55 +02:00
parent 5c1e41cd1c
commit b5bd9beca8

View File

@@ -158,10 +158,9 @@ class AxidrawController : public RobotController
else else
{ {
this->pendown_pub->publish(std_msgs::msg::Empty()); this->pendown_pub->publish(std_msgs::msg::Empty());
while (i + 1 < points.size() && points[i + 1].z <= 0) while (i + count + 1 < points.size() && points[i + count + 1].z <= 0)
{ {
count++; count++;
i++;
} }
} }
@@ -184,6 +183,7 @@ class AxidrawController : public RobotController
RCLCPP_INFO(this->get_logger(), log.c_str()); RCLCPP_INFO(this->get_logger(), log.c_str());
this->path_pub->publish(msg); this->path_pub->publish(msg);
} }
i += count;
// Update status // Update status
feedback->status = std::to_string(i+1) + "/" + std::to_string(points.size()) + " complete"; feedback->status = std::to_string(i+1) + "/" + std::to_string(points.size()) + " complete";