test go home

This commit is contained in:
acki
2025-05-29 16:48:32 -04:00
parent 9c2b794703
commit 6e62774645
2 changed files with 16 additions and 1 deletions

View File

@@ -21,12 +21,14 @@ namespace Modelec
enum Step
{
GO_FRONT,
AWAIT_10S,
GO_HOME,
DONE
} step_;
MissionStatus status_;
std::shared_ptr<NavigationHelper> nav_;
rclcpp::Time go_home_time_;
rclcpp::Node::SharedPtr node_;
rclcpp::Time start_time_;
Point home_point_;

View File

@@ -21,6 +21,8 @@ namespace Modelec
nav_->GoTo(t->x, 1200, -M_PI_2, true, Pathfinding::FREE | Pathfinding::WALL | Pathfinding::OBSTACLE);
go_home_time_ = node_->now();
status_ = MissionStatus::RUNNING;
}
@@ -34,13 +36,24 @@ namespace Modelec
switch (step_)
{
case GO_FRONT:
{
if ((node_->now() - go_home_time_).seconds() >= 10)
{
step_ = AWAIT_10S;
}
}
break;
case AWAIT_10S:
{
auto t = nav_->GetCurrentPos();
nav_->GoTo(t->x, 1700, -M_PI_2, true, Pathfinding::FREE | Pathfinding::WALL | Pathfinding::OBSTACLE);
step_ = GO_HOME;
}
step_ = GO_HOME;
break;
case GO_HOME:
{