-
Notifications
You must be signed in to change notification settings - Fork 226
Refactor Turtlebot Follower. #161
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
Open
kevincwells
wants to merge
2
commits into
turtlebot:indigo
Choose a base branch
from
kevincwells:follower_refactor
base: indigo
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #! /usr/bin/env python | ||
| # Software License Agreement (BSD License) | ||
| # | ||
| # Copyright (c) 2009, Willow Garage, Inc. | ||
| # All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without | ||
| # modification, are permitted provided that the following conditions | ||
| # are met: | ||
| # | ||
| # * Redistributions of source code must retain the above copyright | ||
| # notice, this list of conditions and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above | ||
| # copyright notice, this list of conditions and the following | ||
| # disclaimer in the documentation and/or other materials provided | ||
| # with the distribution. | ||
| # * Neither the name of Willow Garage, Inc. nor the names of its | ||
| # contributors may be used to endorse or promote products derived | ||
| # from this software without specific prior written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| # POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
|
|
||
| PACKAGE='turtlebot_follower' | ||
|
|
||
| import math | ||
|
|
||
| from dynamic_reconfigure.parameter_generator_catkin import * | ||
|
|
||
| gen = ParameterGenerator() | ||
| gen.add("min_x", double_t, 0, "The minimum x position of the points in the box.", -0.20, -3.0, 3.0) | ||
| gen.add("max_x", double_t, 0, "The maximum x position of the points in the box.", 0.20, -3.0, 3.0) | ||
| gen.add("min_y", double_t, 0, "The minimum y position of the points in the box.", 0.10, -1.0, 3.0) | ||
| gen.add("max_y", double_t, 0, "The maximum y position of the points in the box.", 0.50, -1.0, 3.0) | ||
| gen.add("max_z", double_t, 0, "The maximum z position of the points in the box.", 0.8, 0.0, 3.0) | ||
|
|
||
|
|
||
| exit(gen.generate(PACKAGE, "turtlebot_follower_centroid_dynamic_reconfigure", "Centroid")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <!-- | ||
| The turtlebot people (or whatever) follower nodelet. | ||
| --> | ||
| <launch> | ||
| <arg name="simulation" default="false"/> | ||
| <group unless="$(arg simulation)"> <!-- Real robot --> | ||
| <include file="$(find turtlebot_bringup)/launch/3dsensor.launch"> | ||
| <arg name="rgb_processing" value="true"/> <!-- only required if we use android client --> | ||
| <arg name="depth_processing" value="true"/> | ||
| <arg name="depth_registered_processing" value="false"/> | ||
| <arg name="depth_registration" value="false"/> | ||
| <arg name="disparity_processing" value="false"/> | ||
| <arg name="disparity_registered_processing" value="false"/> | ||
| <arg name="scan_processing" value="false"/> | ||
| </include> | ||
| </group> | ||
| <group if="$(arg simulation)"> | ||
| <!-- Load nodelet manager for compatibility --> | ||
| <node pkg="nodelet" type="nodelet" ns="camera" name="camera_nodelet_manager" args="manager"/> | ||
| </group> | ||
|
|
||
| <!-- Real robot: Load centroid goal generator into the 3d sensor's nodelet manager to avoid pointcloud serializing --> | ||
| <!-- Simulation: Load centroid goal generator into nodelet manager for compatibility --> | ||
| <node pkg="nodelet" type="nodelet" name="turtlebot_follower_centroid" | ||
| args="load turtlebot_follower/Centroid camera/camera_nodelet_manager"> | ||
| <remap from="turtlebot_follower_centroid/goal" to="turtlebot_follower/goal"/> | ||
| <remap from="depth/points" to="camera/depth/points"/> | ||
| <param name="min_x" value="-0.35" /> | ||
| <param name="max_x" value="0.35" /> | ||
| <param name="min_y" value="0.1" /> | ||
| <param name="max_y" value="0.5" /> | ||
| <param name="max_z" value="1.2" /> | ||
| </node> | ||
| </launch> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| <library path="lib/libturtlebot_follower"> | ||
| <class name="turtlebot_follower/TurtlebotFollower" type="turtlebot_follower::TurtlebotFollower" base_class_type="nodelet::Nodelet"> | ||
| <description> | ||
| The turtlebot people follower node. | ||
| The turtlebot people and object follower nodelet. | ||
| </description> | ||
| </class> | ||
| <class name="turtlebot_follower/Centroid" type="turtlebot_follower::Centroid" base_class_type="nodelet::Nodelet"> | ||
| <description> | ||
| The centroid calculation nodelet used by Turtlebot Follower. | ||
| </description> | ||
| </class> | ||
| </library> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this should have a leading slash on the value. That makes it not play well with namespaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also thinking about it we probably actually want to keep the nodelet manager name the same and run the nodelets together. Even if it's a low bandwidth connection running in the same process will help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tfoote -- good catch on the leading slash on the manager name.
The reason I created an independent manager to run the follower nodelet itself, rather than running it in the camera_nodelet_manager like it was previously, is because when you abstract away the goal generation, you can no longer guarantee that the camera_nodelet_manager will still exist.
The centroid-based goal generation implemented here launches the camera in the standard way, and runs in the same nodelet manager as that camera to efficiently avoid copying the camera data stream. However, the RealSense Person goal generation nodelet linked above relies on the RealSense Person package, which is not turtlebot-specific, cannot launch the camera in the standard way (it needs to configure additional dimension and framerate options that are not passed through the standard turtlebot_bringup camera launcher), and does not call its nodelet manager camera_nodelet_manager.
Further, since any nodelet could be used to generate the goals, a totally different sensor mechanism that does not rely on cameras at all (e.g., lidar) could be used to tell the robot where to follow.