Since, we expect the first point in the patrol route to be at the origin of the map, the first co-ordinates should be (0.0, 0.0). Next, to define the route, the easiest way to read the points in RViz is by setting the robot at random locations in the map using the '2D Pose Estimate' button in RViz as shown below. For each location, note the x, y co-ordinates in the position field of the base_footprint frame and add it to the security_route array.
Since, we expect the first point in the patrol route to be at the origin of the map, the first co-ordinates should be (0.0, 0.0). Next, to define the route, the easiest way to read the points in RViz is by setting the robot at random locations in the map using the '2D Pose Estimate' button in RViz as shown below. For each location, note the x, y co-ordinates in the position field of the base_footprint frame and add it to the security_route array.
Finally, Press Ctrl+C to exit out of the navigation launch and save the simple_commander_demo.py file. Now, build the workspace to make the updated file available for the next launch command.
Finally, Press Ctrl+C to exit out of the navigation launch and save the simple_commander_demo.py file. Now, build the workspace to make the updated file available for the next launch command.
@ -66,7 +68,9 @@ Then, we set up a path for Stretch to patrol consisting of the co-ordinates in t
Next, we set an initial pose for the robot which would help AMCL localize the robot by providing an initial estimate of the robot's location. For this, we pass a PoseStamped message in the map reference frame with the robot's pose to the setInitialPose() method. The Nav2 stack recommends this before starting the lifecycle nodes using the "startup" button in RViz. The waitUntilNav2Active() method waits until precisely this event.
Next, we set an initial pose for the robot which would help AMCL localize the robot by providing an initial estimate of the robot's location. For this, we pass a PoseStamped message in the map reference frame with the robot's pose to the setInitialPose() method. The Nav2 stack recommends this before starting the lifecycle nodes using the "startup" button in RViz. The waitUntilNav2Active() method waits until precisely this event.
```python
```python
@ -132,4 +136,4 @@ Finally, after a leg of the patrol route is executed, we call the getResult() me
navigator.get_logger().info('Security route failed! Restarting from other side...')
navigator.get_logger().info('Security route failed! Restarting from other side...')
```
```
That's it! Using the simple commander API is as simple as a python library that abstracts away the underlying ROS action layers. Be sure to follow more examples in the [nav2_simple_commander]() package if you want to work with a few other methods exposed by the library.
That's it! Using the simple commander API is as simple as a python library that abstracts away the underlying ROS action layers. Be sure to follow more examples in the [nav2_simple_commander]() package if you want to work with a few other methods exposed by the library.