Bird
Raised Fist0
ROSframework~20 mins

Nav2 in ROS 2 overview - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Nav2 Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary role of Nav2 in ROS 2?
Nav2 is a key component in ROS 2 for robot navigation. What is its main purpose?
ATo manage sensor data collection and preprocessing for mapping
BTo handle low-level motor control commands directly to the robot hardware
CTo provide a complete navigation stack including path planning, control, and recovery behaviors
DTo replace the ROS 2 middleware communication layer
Attempts:
2 left
💡 Hint
Think about what a navigation stack typically includes for a robot.
❓ component_behavior
intermediate
1:30remaining
How does Nav2 handle dynamic obstacles during navigation?
When a robot using Nav2 encounters a new obstacle while moving, how does Nav2 typically respond?
AIt uses recovery behaviors to clear the path or replans a new path around the obstacle
BIt immediately stops the robot and waits for manual intervention
CIt ignores the obstacle and continues on the original path
DIt switches to a different robot controller that can handle obstacles
Attempts:
2 left
💡 Hint
Consider how autonomous navigation systems adapt to changes in their environment.
❓ lifecycle
advanced
2:00remaining
What is the purpose of lifecycle nodes in Nav2?
Nav2 uses lifecycle nodes extensively. What benefit do lifecycle nodes provide in the Nav2 system?
AThey enable nodes to run faster by bypassing ROS 2 communication layers
BThey replace the need for parameter files by hardcoding settings
CThey automatically generate robot maps without user input
DThey allow nodes to be started, stopped, and configured in a controlled way to manage resources and state transitions
Attempts:
2 left
💡 Hint
Think about managing node states and resource usage in a complex system.
📝 Syntax
advanced
2:00remaining
Which YAML snippet correctly configures a Nav2 planner plugin?
Given the need to configure the planner plugin in Nav2, which YAML snippet is syntactically correct?
ROS
planner_server:
  ros__parameters:
    expected_planner: "GridBased"
    planner_plugins:
      - GridBased
    GridBased:
      plugin: "nav2_navfn_planner/NavfnPlanner"
      tolerance: 0.5
A
planner_server:
  ros_parameters:
    expected_planner: GridBased
    planner_plugins:
      - GridBased
    GridBased:
      plugin: nav2_navfn_planner/NavfnPlanner
      tolerance: 0.5
B
planner_server:
  ros__parameters:
    expected_planner: "GridBased"
    planner_plugins:
      - GridBased
    GridBased:
      plugin: "nav2_navfn_planner/NavfnPlanner"
      tolerance: 0.5
C
planner_server:
  ros__parameters:
    expected_planner: GridBased
    planner_plugins: GridBased
    GridBased:
      plugin: nav2_navfn_planner/NavfnPlanner
      tolerance: 0.5
D
planner_server:
  ros__parameters:
    expected_planner: "GridBased"
    planner_plugins:
      GridBased
    GridBased:
      plugin: "nav2_navfn_planner/NavfnPlanner"
      tolerance: 0.5
Attempts:
2 left
💡 Hint
Check YAML indentation, key names, and list syntax carefully.
🔧 Debug
expert
2:30remaining
Why does Nav2 fail to start the controller server node?
You launch Nav2 but the controller server node fails immediately with the error: "Failed to load plugin 'FollowPath'". What is the most likely cause?
AThe plugin library for 'FollowPath' is missing or not installed correctly
BThe lifecycle manager node is not configured
CThe map server node is not running
DThe robot's sensors are not publishing data
Attempts:
2 left
💡 Hint
Consider what 'Failed to load plugin' errors usually mean in ROS 2.

Practice

(1/5)
1. What is the primary purpose of Nav2 in ROS 2?
easy
A. To process sensor data for object recognition
B. To control robot arm movements
C. To manage robot battery levels
D. To help robots plan paths and navigate safely

Solution

  1. Step 1: Understand Nav2's role in ROS 2

    Nav2 is designed to help robots move safely by planning paths and avoiding obstacles.
  2. Step 2: Compare options with Nav2's function

    Only To help robots plan paths and navigate safely describes path planning and safe navigation, which matches Nav2's purpose.
  3. Final Answer:

    To help robots plan paths and navigate safely -> Option D
  4. Quick Check:

    Nav2 = path planning and navigation [OK]
Hint: Nav2 is about robot movement and path planning [OK]
Common Mistakes:
  • Confusing Nav2 with sensor processing
  • Thinking Nav2 controls robot arms
  • Assuming Nav2 manages hardware like batteries
2. Which of the following is the correct way to send a navigation goal to Nav2 in ROS 2?
easy
A. ros2 service call /start_navigation std_srvs/Empty '{}'
B. ros2 topic pub /cmd_vel geometry_msgs/Twist '{linear: {x: 1.0}}'
C. ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose '{pose: {position: {x: 1.0, y: 2.0}}}'
D. ros2 param set /nav2_controller speed 1.0

Solution

  1. Step 1: Identify the command to send a navigation goal

    The correct command uses ros2 action send_goal with the NavigateToPose action and a pose message.
  2. Step 2: Check other options for correctness

    ros2 topic pub /cmd_vel geometry_msgs/Twist '{linear: {x: 1.0}}' publishes velocity commands, not goals. ros2 service call /start_navigation std_srvs/Empty '{}' calls a service unrelated to sending goals. ros2 param set /nav2_controller speed 1.0 sets parameters, not goals.
  3. Final Answer:

    ros2 action send_goal /navigate_to_pose nav2_msgs/action/NavigateToPose '{pose: {position: {x: 1.0, y: 2.0}}}' -> Option C
  4. Quick Check:

    Send goal = ros2 action send_goal [OK]
Hint: Use ros2 action send_goal for Nav2 goals [OK]
Common Mistakes:
  • Using topic publish instead of action send_goal
  • Calling unrelated services
  • Setting parameters instead of sending goals
3. Given the following Nav2 action client code snippet in ROS 2, what will be the output if the robot successfully reaches the goal?
client.send_goal(goal_msg)
result = client.get_result()
print(result.status)
medium
A. An integer status code indicating success
B. A string message describing the error
C. A boolean True if goal reached, False otherwise
D. No output, the code will raise an exception

Solution

  1. Step 1: Understand Nav2 action client result

    The get_result() method returns a result object with a status code as an integer.
  2. Step 2: Interpret the printed status

    Printing result.status outputs an integer code representing success or failure, not a string or boolean.
  3. Final Answer:

    An integer status code indicating success -> Option A
  4. Quick Check:

    result.status = integer code [OK]
Hint: Nav2 action results use integer status codes [OK]
Common Mistakes:
  • Expecting a string message instead of code
  • Thinking result.status is boolean
  • Assuming code raises exception on success
4. You wrote a Nav2 client node but it never moves the robot after sending a goal. Which of the following is the most likely cause?
medium
A. The robot's wheels are physically blocked
B. The Nav2 stack is not running or not properly launched
C. The robot's battery is low
D. The goal message has an incorrect frame_id

Solution

  1. Step 1: Check common Nav2 goal issues

    If the Nav2 stack is not running or not properly launched, the robot will not move because the navigation system is inactive.
  2. Step 2: Evaluate other options

    While an incorrect frame_id can cause issues, the most common cause when the robot never moves after sending a goal is that the Nav2 stack is not running. Hardware issues like blocked wheels or low battery are less likely in software debugging context.
  3. Final Answer:

    The Nav2 stack is not running or not properly launched -> Option B
  4. Quick Check:

    Nav2 stack running = robot moves [OK]
Hint: Ensure Nav2 stack is running if robot doesn't move [OK]
Common Mistakes:
  • Assuming Nav2 stack is always running
  • Ignoring coordinate frame mismatches
  • Blaming hardware before software checks
5. You want your robot to navigate through a dynamic environment using Nav2 in ROS 2. Which combination of Nav2 components should you configure to ensure the robot replans paths when obstacles move?
hard
A. Use the planner_server with a global planner and enable the controller_server with obstacle avoidance
B. Use only the behavior_tree without planners or controllers
C. Disable the controller_server and rely on manual velocity commands
D. Use the map_server alone to update the robot's position

Solution

  1. Step 1: Identify components for path planning and obstacle avoidance

    The planner_server creates global paths, and the controller_server handles local obstacle avoidance and path following.
  2. Step 2: Understand dynamic replanning needs

    Enabling both planner and controller servers allows Nav2 to replan paths when obstacles move, ensuring safe navigation.
  3. Final Answer:

    Use the planner_server with a global planner and enable the controller_server with obstacle avoidance -> Option A
  4. Quick Check:

    Planner + Controller = dynamic replanning [OK]
Hint: Planner and controller servers enable dynamic path replanning [OK]
Common Mistakes:
  • Ignoring controller_server role in obstacle avoidance
  • Thinking behavior_tree alone handles planning
  • Relying only on map_server for navigation
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard