Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge development work to the master branch. #38

Merged
merged 26 commits into from
Sep 6, 2018
Merged

Conversation

mjeronimo
Copy link

This is early work to get a basic architectural shell in place, based on a task hierarchy concept.

Michael Jeronimo and others added 10 commits July 24, 2018 09:16
* Add the requirements document

* Update up-front material in requirements doc based on review feedback

* Update Mission Planning and Execution sections

* Begin integration of separate sections into a Planning section

* Work on the Planning requirements section

* More work on the Mapping section

* Change Control -> Execution

* Update the Planning and Execution sections

* Address more review feedback

* Address Matt's feedback

* Address Matt's feedback

* Check in an initial sketch of the mission execution code

* Begin adding some sample state machine implementation code

* Add the state machine transitions

* Add some ROS messaging input to the MissionExecution

* Begin sketching other levels of the stack

* Remove include directory at the top level

* Remove NavigationCommand in favor of NavigationTask

* Add mission_planning directory and a few minor edits

* Add a Doxyfile; add RosRobot class

* Fix issues from lint and uncrustify

* Add the architecture model to the repo

* Add a cmake file for the robot directory

* Make some changes to the Task hierarchy

* Update some comments in Task about our approach
More work on basic command chain class hierarchy.
* Move some of the task base classes out to separate directories.
* Implement start/stop for TaskClient and TaskServer
…sk hierarchy (#12)

Implement the basic structure for the command chain modules.
* Cleaning up build exports and imports.

* Adding auto uncrustify and cppcheck to the build.

This will automatically run uncrustify, cppcheck, and cpplint
whenever you run the test suite (eg. colcon test)

Also, somewhat unrelated, I added whitespace to package.xml to
make it a bit easier to read.
* Created the DijkstraPlanner based on the core algorithms from Navfn ROS1 nav package.

* Updated the SimpleNavigator to use the new DijkstraPlanner

* Created an initial WorldModel node and Costmap mockup to test the new planner.

* Fixed bug with TaskClient.

* Added a few new messages and services related to Costmap. Made a few updates to the Path messages.
#28)

* Modify the directory structure to allow for multiple implementations of a given task type.

Also create a shell BtNavigator class and introduce namespaces.
Copy link
Collaborator

@mkhansenbot mkhansenbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the empty files:
CHANGELOG.rst
README.md
.gitignore

Should we have these in every package directory, or just at the top level of the repo?

Doxyfile Show resolved Hide resolved
Copy link
Collaborator

@mkhansenbot mkhansenbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the file names should conform to the Google standard:
https://google.github.io/styleguide/cppguide.html#File_Names
The ROS and ROS2 Style guides seem to follow that. So MissionExecutor.hpp would become mission_executor.hpp

MJ: I've updated the filenames.

// License: Apache 2.0. See LICENSE file in root directory.
// Copyright 2018 Intel Corporation. All Rights Reserved.

#ifndef MISSION_EXECUTION__MISSIONEXECUTION_HPP_
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per Google's style guide:
https://google.github.io/styleguide/cppguide.html#The__define_Guard

Probably should rename the file to mission_execution.hpp and the define guard to MISSION_EXECUTION__MISSION_EXECUTION_HPP_


MissionExecution::~MissionExecution()
{
RCLCPP_INFO(get_logger(), "MissionExecution::~MissionExecution");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this a little more user friendly log information like "Mission Execution Node is shutting down" or something like that?

void
MissionExecution::executeMission(const MissionPlan * missionPlan)
{
RCLCPP_INFO(get_logger(), "MissionExecution::executeMission");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly can we make this "Executing Mission Plan"?

void
MissionExecution::cancelMission()
{
RCLCPP_INFO(get_logger(), "MissionExecution::cancelMission");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Cancelling Mission"

MissionExecutor::MissionExecutor(const std::string & name)
: nav2_tasks::ExecuteMissionTaskServer(name)
{
RCLCPP_INFO(get_logger(), "MissionExecutor::MissionExecutor");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change these RCLCPP_INFO statements to something like "Starting Mission Executor", "Shutting down..." etc.

Copy link
Author

@mjeronimo mjeronimo Aug 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. These were just to ensure everything was created and wired up correctly. We can go back and make them more meaningful as we implement the modules.

break;

default:
RCLCPP_INFO(get_logger(), "MissionExecutor::executeAsync: invalid status value");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be RCLCPP_ERROR instead of INFO?

Copy link
Author

@mjeronimo mjeronimo Aug 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fixed.

{
std::cout << "onCommandReceived\n";
commandMsg_ = msg;
shouldExecute_ = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design question - I'm not sure I understand why a thread is needed at all, couldn't the OnCommandReceived() method call the WorkerThread() method directly instead of setting a flag here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working under the assumption that we don't want to use one of the ROS threads for doing potentially long-running work. Instead, we want to do the minimum and return the thread to ROS for handling other input messages. I don't know if there's a convention or guidance in the ROS community for this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check what rclcpp::executor is doing. I was assuming it spawns a thread for every callback it makes, but I could be wrong.

@mkhansenbot
Copy link
Collaborator

I haven't finished reviewing, will do more tomorrow.

}

// The client can tell the TaskServer to execute its operation
void executeAsync(const typename CommandMsg::SharedPtr msg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be better named "sendAsyncCommand", or as they do in rclcpp services "send_async_request". executeAsync is a bit confusing (at least to me) as the execution is actually on the server side. We're just requesting/commanding that execution to begin.

* Fix race conditions with the TaskClient and TaskServer templates
* Code formatting per cpplint and uncrustify
* Remove empty test directories for tasks
* Address initial PR (#38) feedback.
* Incorporate Carl's recommendations on TaskClient/Server
switch (status) {
case TaskStatus::SUCCEEDED:
RCLCPP_INFO(get_logger(), "SimpleNavigator::execute: planning task completed");
goto here;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a goto and not a break?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it really needs to be a goto, can we at least rename the label from "here" to "task_succeeded" or something similar that is self documenting?

@@ -0,0 +1,173 @@
// Copyright (c) 2018 Intel Corporation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the TaskClient.hpp file was accidentally added back in when the last commit was pushed. It was previously renamed to task_client.hpp, right? Now they're both in.

: nav2_tasks::ExecuteMissionTaskServer(name)
{
RCLCPP_INFO(get_logger(), "MissionExecutor::MissionExecutor");
navigationTask_ = std::make_unique<nav2_tasks::NavigateToPoseTaskClient>("SimpleNavigator", this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit - calling this client "SimpleNavigator" is confusing since the SimpleNavigator class is a server. I guess this is the client side to that, but it could be the client side to any Navigation Server right? Or do I not understand correctly? If it is a client and the server can be provided by something other than the SimpleNavigator server, then can it be "NavigationClient"

: nav2_tasks::ExecuteMissionTaskServer(name)
{
RCLCPP_INFO(get_logger(), "MissionExecutor::MissionExecutor");
navigationTask_ = std::make_unique<nav2_tasks::NavigateToPoseTaskClient>("SimpleNavigator", this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"SimpleNavigator" should be "NavigationClient" or something similar.

: nav2_tasks::NavigateToPoseTaskServer(name)
{
RCLCPP_INFO(get_logger(), "BtNavigator::BtNavigator");
planner_ = std::make_unique<nav2_tasks::ComputePathToPoseTaskClient>("AStarPlanner", this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should "AStarPlanner" be "PlannerClient" and similarly "DwaController" be "FollowPathClient"? Or am I missing something? I don't think the client is tied to a specific implementation of the server, is it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. These should be interface names rather than specific implementation names (as it is now). I'll change this.

Copy link
Collaborator

@mkhansenbot mkhansenbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets file issues to track the few comments I made above, then we can merge this.

src/libs/nav2_tasks/include/nav2_tasks/task_client.hpp Outdated Show resolved Hide resolved
auto startTime = std::chrono::high_resolution_clock::now();

while (node_->count_subscribers(taskName) < 1) {
rclcpp::spin_some(node_->get_node_base_interface());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just pass in the node here? That's how the spin* functions normally work.

src/libs/nav2_tasks/include/nav2_tasks/task_client.hpp Outdated Show resolved Hide resolved
std::bind(&TaskClient::onStatusReceived, this, std::placeholders::_1));
}

TaskClient() = delete;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the style we want to use? The default constructor is already gone because you specified an explicit constructor. This line is unnecessary, but maybe desirable for documentation purposes. My preference is to leave it out.

@@ -28,6 +28,12 @@ DwaController::DwaController(const std::string & name)
RCLCPP_INFO(get_logger(), "DwaController::DwaController");
}

DwaController::DwaController()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just make the name a default parameter to the first constructor?

@@ -25,7 +25,7 @@ class DwaController : public nav2_tasks::FollowPathTaskServer
{
public:
explicit DwaController(const std::string & name);
DwaController() = delete;
DwaController();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the constructor with a name explicit, but not the constructor without a name?

@@ -79,7 +79,7 @@ SimpleNavigator::execute(const nav2_tasks::NavigateToPoseCommand::SharedPtr /*co
switch (status) {
case TaskStatus::SUCCEEDED:
RCLCPP_INFO(get_logger(), "SimpleNavigator::execute: planning task completed");
goto here;
goto planning_succeeded;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function should be restructured to eliminate the goto.

src/control/nav2_dwa_controller/package.xml Outdated Show resolved Hide resolved
Copy link
Collaborator

@mkhansenbot mkhansenbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest changes look good to me. I'm good with merging this as long as you've filed issues for any open items.

@mjeronimo mjeronimo merged commit acd0a55 into master Sep 6, 2018
@mjeronimo mjeronimo deleted the ros2_devel branch October 10, 2018 16:58
ghost referenced this pull request in logivations/navigation2 Mar 7, 2022
* obstacle avoidance fine tune

* revert bin number

* add log that tells which motion primitives are used

* change dx, dy

* typo

* finetune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants