ROS2 Navigation Unit 2 - Getting Started

So I am having trouble getting started in this unit

It implies there should be a cartographer_ros pkg as a wrapper, am I expected to read that documentation and build the pkg?
I see nothing mentioned about it other than a description.

To launch `cartographer,’ launch two nodes:

1. Launch of the cartographer_node

These are the fields you need to indicate in the node launch:

  • The cartographer_node is provided by the package cartographer_ros
  • The executable is called cartographer_node
  • The parameters it requires are:
    1. use_sim_time: is a boolean indicating whether the node must synchronize its time with the simulation
  • The arguments are:
    1. configuration_directory: the directory where to find the configuration files
    2. configuration_basename: the config file name

might be obvious for some others, but I see no cartographer_ros pkg in my ros2_ws directory
user:~/ros2_ws/src$ ls
ros2_nav_files
user:~/ros2_ws/src$

Hi Eldgar,
The task you have to do is build a launch file using the cartographer_ros package with the specifications mentioned. As you said there is no cartographer_ros in your ros2_ws. However, if you run “ros2 pkg list” you will see cartographer_ros package, that means is already sourced in your workspace. Also, you can see where is installed or where it comes from with the command: “ros2 pkg prefix package_name” and if you replace “package_name” with cartographer_ros you will see where is the package installed.

2 Likes

OK thanks.

So it looks like I don’t edit the launch files in the /opt/ros/humble but in the launch directory of nav2_project

def generate_launch_description():
return LaunchDescription([
#SetEnvironmentVariable(‘RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED’, ‘1’),
SetEnvironmentVariable(‘RCUTILS_LOGGING_BUFFERED_STREAM’, ‘1’),
Node(
package=‘cartographer_ros’, node_executable=‘cartographer_node’, output=‘screen’,
arguments=[
‘-configuration_directory’, get_package_share_directory(‘nav2_project’) + ‘/config’,
‘-configuration_basename’, ‘cartographer.lua’
],
),
Node(
package=‘cartographer_ros’,
node_executable=‘occupancy_grid_node’,
output=‘screen’,
arguments=[‘-resolution’, ‘0.02’, ‘-publish_period_sec’, ‘1.0’]
),
])

Only a few minor shanges

Hi Eldgar,
you need to take first the ROS2 Basics (Python) course so you will understand better those points. You need to know the content of ROS 2 Basics before taking this Navigation course, because it provides the basic knowledge for understanding third party packages.

The Cartographer and the Nav2 are a third party packages, and we are using them for doing the navigation

Yes I did take the ros2 basics course.

All the work I did there mostly involved making my own packages in the ros2_ws/src directory.
That’s why I was a bit confused.

Do not worry Eldgar, it is confusing. After some practice or more courses you will get all those concepts internalized!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.