Skip to content

Commit

Permalink
Fixed the dubins path following and the output is initialized correctly.
Browse files Browse the repository at this point in the history
The dubins path was always going back to 0,0. This was undesirable.
Also, because the output struct was not initialized, when plotting
values in the struct, they would start at a random, usually very large,
value.
  • Loading branch information
iandareid committed Jan 6, 2025
1 parent 4a64e24 commit ddd2db5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rosplane/include/path_manager_example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class PathManagerExample : public PathManagerBase
std::chrono::time_point<std::chrono::system_clock> start_time_;
FilletState fil_state_;

bool first_;

/**
* @brief Determines the line type and calculates the line parameters to publish to path_follower
*/
Expand Down
10 changes: 10 additions & 0 deletions rosplane/src/path_manager_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@ void PathManagerBase::current_path_publish()
input.chi = vehicle_state_.chi;

Output output;
output.va_d = 0;
output.r[0] = 0;
output.r[1] = 0;
output.r[2] = 0;
output.q[0] = 0;
output.q[1] = 0;
output.q[2] = 0;
output.c[0] = 0;
output.c[1] = 0;
output.c[2] = 0;

if (state_init_ == true) {
manage(input, output);
Expand Down
11 changes: 10 additions & 1 deletion rosplane/src/path_manager_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ PathManagerExample::PathManagerExample()
params_.set_parameters();

start_time_ = std::chrono::system_clock::now();

first_ = true;
}

void PathManagerExample::manage(const Input & input, Output & output)
Expand Down Expand Up @@ -154,7 +156,6 @@ void PathManagerExample::manage_fillet(const Input & input, Output & output)
increment_indices(idx_a_, idx_b, idx_c, input, output);

if (orbit_last && idx_a_ == num_waypoints_ - 1) {
// TODO: check to see if this is the correct behavior.
return;
}

Expand Down Expand Up @@ -399,6 +400,14 @@ void PathManagerExample::manage_dubins(const Input & input, Output & output)
} else {
idx_a_++;
idx_b = idx_a_ + 1;

if (first_) {
first_ = false;
waypoints_.erase(waypoints_.begin());
num_waypoints_--;
idx_a_--;
idx_b = idx_a_ + 1;
}
}

// plan new Dubin's path to next waypoint configuration
Expand Down

0 comments on commit ddd2db5

Please sign in to comment.