Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize the AMCL node in ROS.
ROS
ros::init(argc, argv, [1]);Attempts:
3 left
💡 Hint
Common Mistakes
Using other node names like "move_base" or "map_server" which are different ROS nodes.
Leaving the node name empty or incorrect.
✗ Incorrect
The AMCL node is initialized with the name "amcl" to identify it properly in ROS.
2fill in blank
mediumComplete the code to subscribe to the laser scan topic for AMCL.
ROS
ros::Subscriber laser_sub = nh.subscribe([1], 1000, laserCallback);
Attempts:
3 left
💡 Hint
Common Mistakes
Subscribing to "/odom" which is odometry data, not laser scan.
Using "/cmd_vel" which is velocity commands, not sensor data.
✗ Incorrect
AMCL uses laser scan data from the "/scan" topic to localize the robot.
3fill in blank
hardFix the error in the AMCL parameter setting to correctly set the minimum particles.
ROS
private_nh.param("min_particles", [1], 500);
Attempts:
3 left
💡 Hint
Common Mistakes
Using the parameter name string instead of the variable.
Using a variable name that does not exist.
✗ Incorrect
The variable to store the parameter value should match the variable name used in the code, often with an underscore suffix like min_particles_.
4fill in blank
hardFill both blanks to correctly create a particle filter object and initialize it.
ROS
amcl::[1] pf; pf.[2]();
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong class names like LocalizationFilter.
Calling start() instead of initialize().
✗ Incorrect
The particle filter class is ParticleFilter and it is initialized by calling the initialize() method.
5fill in blank
hardFill all three blanks to correctly set up the AMCL update loop with odometry and laser data.
ROS
while (ros::ok()) { ros::spinOnce(); pf.[1](odom_data); pf.[2](laser_data); pose = pf.[3](); }
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up updateAction and updateSensor methods.
Using processData which is not a standard method.
✗ Incorrect
The particle filter updates its state with odometry using updateAction(), updates sensor data with updateSensor(), and retrieves the best pose with getBestParticlePose().
