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

How does move_base publish to cmd_vel?

asked 2020-11-30 19:49:29 -0500

KennyxD gravatar image

Hi,

I was wondering if someone out there can give me some clarification on the move_base.launch.

To explain what I am doing, I have a robot car using RPLidar and Hector SLAM with no Odometry. I am able to control my robot using the teleop_twist_keyboard node and have it drive around and create a map. Now I am trying to have it be autonomous and I heard that using move_base is a method to do this.

I have created costmap_common_params.yaml, global_costmap_params.yaml, local_costmap_params.yaml, and base_local_planner_params.yaml and my own move_base.launch file following this tutorial: http://wiki.ros.org/navigation/Tutori...

However, I do not understand how this will publish to the cmd_vel topic. I do not see anywhere on the tutorial where it publishes.

Can anyone give me some clarification?

Thanks in advance!

edit retag flag offensive close merge delete

Comments

Did you go over the wiki and the documentation therein, especially http://wiki.ros.org/move_base? There, it is pretty evident, where the publishing happens.

mgruhler gravatar image mgruhler  ( 2020-12-01 01:05:29 -0500 )edit

Hi mgruhler!

Thank you for your reply.

Yes, I have seen that documentation but I am still a bit confused. You see, I am new to ROS and I learned from the tutorial (http://wiki.ros.org/ROS/Tutorials/Wri...) that to create a publisher node you need a code something like this:

pub = rospy.Publisher('chatter', String, queue_size=10)

So I guess why I am confused about is that I do not see this line of code anywhere for move_base. Which makes me wonder how does it publish to cmd_vel?

KennyxD gravatar image KennyxD  ( 2020-12-01 16:53:50 -0500 )edit

Well, I guess you didn't look at the source code? The publisher is created here

Note that move_base is quite a complex piece of software, so if you are new to ROS and, maybe, not very experienced in programming, this might be hard to step through bit by bit. The tutorial you link in your question only shows how to configure the various pieces that make up a fully working navigation setup...

mgruhler gravatar image mgruhler  ( 2020-12-02 02:51:54 -0500 )edit

Oh, thank you so much for sending me the source code!

Yes, I do agree that this is a difficult task for a newcomer like me.

I have looked at how other people autonomously navigate their robot and I kept seeing them run 3 things: 1. RPLidar, 2. Hector slam launch file, and 3. move_base launch file. And from there, they would use the 2D Pose Estimate button to identify the initial position of the robot and then use the 2D Nav Goal on Rviz and their robot would start moving. I guess I misunderstood how they did their coding and didn't realize they had another code that is also called move_base that is not the launch file.

Thank you for the clarification!

KennyxD gravatar image KennyxD  ( 2020-12-02 10:17:45 -0500 )edit

Well, yes. A launch file is not "code" in itself (well, it is XML, but anyways...). A launch file is used to easily configure and run nodes, whether they have been programmed with C++, Python or any other ROS supported language (in the end, it just launches executables, so you could launch any executable file, like e.g. shell scripts). This should be the main take away here. A launch file can also launch multiple nodes.

mgruhler gravatar image mgruhler  ( 2020-12-04 00:42:08 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-12-02 00:54:00 -0500

bfdmetu gravatar image

Move base works with goal. When move_base gets goal ( in rviz 2D nav goal button or terminal ) , it starts publishing cmd_vel..

This is the detailed information

http://wiki.ros.org/navigation/Tutori...

edit flag offensive delete link more

Comments

Thank you for this link! I will definitely use it to create a node that sends the goal.

KennyxD gravatar image KennyxD  ( 2020-12-02 13:18:56 -0500 )edit
0

answered 2020-12-02 03:18:58 -0500

rodrigo55 gravatar image

Hi,

move_base uses a navigation goal in order to send out cmd_vel messages to the robot, and gets updated with the /odom topic that it subscribes to and the amcl node that aids localization.

If you want an in depth explanation, I made this video that might help:

https://www.youtube.com/watch?v=G5_sA...

edit flag offensive delete link more

Comments

Thank you so much for making the video! Definitely clarified some concepts for me!.

I probably can't use exactly everything that you showed since I don't have odometry for my robot. Also, I believe that Hector Slam uses hector mapping which does SLAM and AMCL for localization. So with this, I don't think need to save my map prior to using move_base.

Let me know if I got it wrong. Thanks!

KennyxD gravatar image KennyxD  ( 2020-12-02 13:15:11 -0500 )edit

You're welcome! I haven't worked with Hector SLAM, but you're right, the name implies that it's already doing simultaneous localization and mapping.

rodrigo55 gravatar image rodrigo55  ( 2020-12-07 03:01:33 -0500 )edit

Can you please update your answer with main points from the video? If your video goes down or isn't available for certain regions then your answer/solution isn't as useful. Also, some prefer text to 20+ minute video

jayess gravatar image jayess  ( 2021-03-11 00:13:47 -0500 )edit
1

if you successfully used move base with hector slam without any use of Odom can you write the main steps and files on how to do so (i am also using lidar )and finished building the map any help will be appreciated as it is for my graduation project

mada63 gravatar image mada63  ( 2021-04-17 09:12:03 -0500 )edit

@rodrigo55, tries to follow your video to create a rosject. but catkin_make failed to build it. it stopped at "-- BUILD_SHARED_LIBS is on". Any suggestion? Thank you.

gzpROS gravatar image gzpROS  ( 2021-05-22 00:48:31 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-11-30 19:49:29 -0500

Seen: 2,301 times

Last updated: Dec 02 '20