ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
5

What is the recommended way to give a robot a predefined set of waypoints?

asked 2017-01-17 14:40:13 -0500

Cristian11235 gravatar image

updated 2017-01-25 01:28:10 -0500

I am assuming I have a map, and the robot is localized within it. I would like to give an input of waypoints as a csv, json, or similar, and I would like the robot to travel there.

The waypoints need to be generated based on the map, to make sure they are valid.

I can subscribe to the map topic, and get the map that way, but I am not sure how I can send a set of points to which the robot needs to travel to.

I would also like to specify the direction in which the robot should face, at those locations. (I want my robot to travel in a grid like pattern, stopping at every intersection)

What is the ROS way of doing this?

Thank you

EDIT: I found a way to solve the problem, it involves the method M@t mentioned. Here is my code for anybody that needs it:

https://github.com/cristian-frincu/si...

edit retag flag offensive close merge delete

Comments

Hi @Cristian11235 This may seem to be off topic or against the norms here as I'm not creating a question, but I couldn't find any other way. Guess I'm posting pretty late. I did try using your script. Is it such that the goal points created appear out of the map frame for maps other than the one included with the script? When I use it on a different map, the selected waypoints have locations out of the map frame and so do the ones created in between them. Would it be possible to know why this happens?

Thank you.

spiritninja gravatar image spiritninja  ( 2019-05-29 00:21:57 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
7

answered 2017-01-17 22:19:00 -0500

M@t gravatar image

updated 2018-01-30 19:00:27 -0500

I've done exactly what you're asking for:

image description

So I'll briefly describe what you can do. Building on what spmaniato said, you can use three core components:

  1. The Navigation Stack (specifically the move_base node): The move_base node lets you specify a move goal in any reference frame that the robot will then attempt to reach. The move_base node uses a local and global costmap, and it will generally throw an error if you issue a move goal that is outside either of these maps or is otherwise impossible to reach (because it is inside an obstacle for example). You can also specify a desired heading. However, the move_base node won't give you any feedback on how close you are to a goal or when you've reached it which is why you can use...
  2. The actionlib package Which implements a action client-server system that allows you to issue commands and get feedback on their state such as "SUCCEEDED" or "ACTIVE". move_base actually provides a basic implementation for an action server, and simple move goal commands. So all you need to do is write an action client which can be...
  3. A custom ROS node written by you This node needs to read your .txt or .csv file, issue a command, check the status and issue a new one all within a 'for' or 'while' loop. This node will act as the client half of the actionlib package. When writing this node I suggest you start with this tutorial. If you're coding in C++ you can copy and paste code. If you're coding in Python there isn't an equivalent tutorial unfortunately, but there is another ROS answers question that provides some python code do this here. I think there is also some questions on ros.answers somewhere that also show you how to do the same thing in python.

This should give you an idea of which ROS packages to start looking at. I'm a bit pressed for time, hence the short explanation. But if you have any issues just ask and I can go into more detail and provide some of the code I used.

[EDIT:] If you want to skip the actionlib stuff and do all the checking/feedback stuff yourself you can issue a move_base_msg to the /move_base/goal topic directly. Also, if your move goals are quite far away from the robot (more than 10 m) there are some specific changes you may want to make to the navigation stack to make it accurate over longer distances (again, I can go into greater detail if you ask me to)

edit flag offensive delete link more

Comments

@M@t Do you mind sharing more about specific changes to make to the navigation stack to make it accurate over longer distances? I'm doing a gps-based waypoint navigation. Thanks

the3kr gravatar image the3kr  ( 2021-02-04 13:57:02 -0500 )edit

Honestly I haven't touched the nav stack in a while, and the comments section isn't really the place to have that discussion. I suggest you open your own ROS question, describe your setup and what you are trying to do, then ask for advice. That way the whole community can provide answers as well as just me.

M@t gravatar image M@t  ( 2021-02-06 16:36:53 -0500 )edit
1

answered 2017-01-17 14:50:37 -0500

spmaniato gravatar image

Sounds like a usecase for the ROS navigation stack. See http://wiki.ros.org/navigation/Tutorials

For automatically generating the waypoints, you will either have to write a script that feeds move_base with navigation goals or write your own global_planner plugin.

edit flag offensive delete link more

Comments

That is sort of what I figured, When would you write a script to feed to move_base, and when would you write a global_planner?

Any advantages/ disadvantages of each?

Cristian11235 gravatar image Cristian11235  ( 2017-01-17 14:52:48 -0500 )edit
1

If the waypoints were fixed (a list of them for a given map), then a Python script is definitely the way to go. I would start there regardless because it's gonna have a less steep learning curve. Writing a global planner plugin is much more involved (and has to be done in C++)

spmaniato gravatar image spmaniato  ( 2017-01-17 14:55:46 -0500 )edit

Also, here's a video that looks similar to what you want to achieve: https://www.youtube.com/watch?v=RFdlX... (from http://answers.ros.org/question/25222... )

spmaniato gravatar image spmaniato  ( 2017-01-17 14:56:23 -0500 )edit
1

The nav stack comes with some default global/local path planners and I suggest you at least start with those. In general, I'd advise that you go with navigation stack defaults on everything, get it all working then start changing stuff.

M@t gravatar image M@t  ( 2017-01-17 22:29:54 -0500 )edit

Question Tools

6 followers

Stats

Asked: 2017-01-17 14:40:13 -0500

Seen: 6,405 times

Last updated: Jan 30 '18