Skip to content

Commit

Permalink
fix reset behavior logic
Browse files Browse the repository at this point in the history
Signed-off-by: Masaya Kataoka <[email protected]>
  • Loading branch information
hakuturu583 committed Apr 4, 2024
1 parent ea72ff5 commit 2691f01
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions simulation/do_nothing_plugin/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ void DoNothingBehavior::configure(const rclcpp::Logger &) {}

void DoNothingBehavior::update(double current_time, double step_time)
{
setCurrentTime(current_time);
setStepTime(step_time);

const auto follow_polyline_trajectory = [&]() {
do_nothing_behavior::follow_trajectory::checkPolylineTrajectory(getPolylineTrajectory());
if (
Expand All @@ -149,14 +152,12 @@ void DoNothingBehavior::update(double current_time, double step_time)
setUpdatedStatus(entity_status_);
}
if (
getCurrentTime() + getStepTime() <=
getCurrentTime() + getStepTime() >=
do_nothing_behavior::follow_trajectory::getLastVertexTimestamp(getPolylineTrajectory())) {
setRequest(traffic_simulator::behavior::Request::NONE);
}
};

setCurrentTime(current_time);
setStepTime(step_time);
entity_status_->setTime(current_time);
if (getRequest() == traffic_simulator::behavior::Request::FOLLOW_POLYLINE_TRAJECTORY) {
follow_polyline_trajectory();
Expand Down

0 comments on commit 2691f01

Please sign in to comment.