turtlebot / turtlebot_apps

A group of simple demos and exmaples to run on your TurtleBot to help you get started with ROS and TurtleBot.
http://www.ros.org/wiki/turtlebot_apps
196 stars 225 forks source link

Refactor Turtlebot Follower. #161

Open kevincwells opened 7 years ago

kevincwells commented 7 years ago

Pulled centroid-generation and publication out into a separate nodelet, leaving Follower just responsible for listening for and responding to goal points.

In this version, the Follower nodelet subscribes to a /turtlebot_follower/goal topic, and uses the geometry_msgs/Point message as the x, y, and z goal point it should follow.

A separate Centroid nodelet contains the original centroid calculation logic, and publishes its results to a topic that can be mapped to Follower's goal. The already-existing change_state service is used to stop the robot when the goal is out of range.

The purpose of this refactor is to allow any number of feature/object detection-and-tracking packages to be used to generate the Follower goal, not just the simplistic centroid calculation logic in the base implementation. A more sophisticated person-tracking library, for example, could tell the Turtlebot to follow only a specific person.

To see an example of an alternative person-tracking configuration like the one mentioned above, see this fork. Please note that the above-linked package relies on an internal, still-in-development _realsenseperson package to be built and run, but you can still easily look at the supplied launch file to see how the refactored turtlebot_follower package is being included with the "generate_goal" parameter turned off, and instead the realsense_person_turtlebot_follower package is used to generate the goal messages.

kevincwells commented 7 years ago

@tfoote -- just checking to see if anyone has taken a look at this. For reference, the Kinetic build is failing due to the same CMake warnings that make all the other current PR's fail.

FYI - the above-linked "Realsense Person Turtlebot Follower" fork has been updated using the forthcoming Realsense Person body-tracking library to stop sending Follower goal messages if the user holds their hand in the air. As this code still relies on on as-of-yet-unreleased Intel libraries to build and run, you cannot directly test it out yourself. That said, I bring it to your attention to further illustrate how this refactored Turtlebot Follower design allows outside packages to build upon and improve the simple Turtlebot Follower demo and use case, while highlighting the features they provide. The default Turtlebot Follower demo requires the user to very quickly remove themselves from the Turtlebot's field of view in order to end the demo. In our version, the user can simply hold their hand up and easily walk out of the frame.

kevincwells commented 7 years ago

The dedicated CarrotGoal message idea is interesting. You're right that the RealSense Person goal generation nodelet does require the robot to be further away than the default value to keep the person in frame; I currently handle this by setting the goal_z parameter in the launch file when I include the turtlebot_follower launch file.