Devel/add nav2 tools#2
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds Nav2 navigation tools to the TurtleBot3 agent, enabling autonomous navigation capabilities with path planning and obstacle avoidance. The changes integrate the Nav2 navigation stack while restructuring the available tools.
- Adds NavigateToPose action client integration for autonomous navigation
- Implements coordinate transformation functionality between odom and map frames
- Restructures tool configuration by removing basic motion tools and adding navigation-focused tools
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| turtlebot3_agent/tools/motion_tools.py | Adds navigate_to_pose and transform_odom_to_map tool implementations |
| turtlebot3_agent/tools/all_tools.py | Updates tool configuration to include new navigation tools while removing basic motion tools |
| turtlebot3_agent/tb3_node.py | Implements Nav2 action client, TF2 coordinate transformation, and changes odometry topic |
| launch/tb3_agent.launch.py | Changes simulation environment from empty_world to turtlebot3_world |
| odom_x: float = Field(description="X coordinate in pose frame (meters)") | ||
| odom_y: float = Field(description="Y coordinate in pose frame (meters)") | ||
| odom_yaw: float = Field(description="Yaw angle in pose frame (radians)") |
There was a problem hiding this comment.
The field description says 'pose frame' but the parameter name and function context suggest it should be 'odom frame' to match the function's purpose of transforming from odom to map frame.
| odom_x: float = Field(description="X coordinate in pose frame (meters)") | |
| odom_y: float = Field(description="Y coordinate in pose frame (meters)") | |
| odom_yaw: float = Field(description="Yaw angle in pose frame (radians)") | |
| odom_x: float = Field(description="X coordinate in odom frame (meters)") | |
| odom_y: float = Field(description="Y coordinate in odom frame (meters)") | |
| odom_yaw: float = Field(description="Yaw angle in odom frame (radians)") |
| odom_x: float = Field(description="X coordinate in pose frame (meters)") | ||
| odom_y: float = Field(description="Y coordinate in pose frame (meters)") | ||
| odom_yaw: float = Field(description="Yaw angle in pose frame (radians)") |
There was a problem hiding this comment.
The field description says 'pose frame' but should be 'odom frame' to accurately describe the coordinate system being used as input.
| odom_x: float = Field(description="X coordinate in pose frame (meters)") | |
| odom_y: float = Field(description="Y coordinate in pose frame (meters)") | |
| odom_yaw: float = Field(description="Yaw angle in pose frame (radians)") | |
| odom_x: float = Field(description="X coordinate in odom frame (meters)") | |
| odom_y: float = Field(description="Y coordinate in odom frame (meters)") | |
| odom_yaw: float = Field(description="Yaw angle in odom frame (radians)") |
| class TransformInput(BaseModel): | ||
| odom_x: float = Field(description="X coordinate in pose frame (meters)") | ||
| odom_y: float = Field(description="Y coordinate in pose frame (meters)") | ||
| odom_yaw: float = Field(description="Yaw angle in pose frame (radians)") |
There was a problem hiding this comment.
The field description says 'pose frame' but should be 'odom frame' to match the parameter name and function purpose.
| odom_yaw: float = Field(description="Yaw angle in pose frame (radians)") | |
| odom_yaw: float = Field(description="Yaw angle in odom frame (radians)") |
| # Nav2 Action Client | ||
| self._nav_client = ActionClient(self, NavigateToPose, "/navigate_to_pose") | ||
|
|
||
| # TF2 Buffer and Listener for coordinate transformations - この2行を追加 |
There was a problem hiding this comment.
The comment contains Japanese text ('この2行を追加' meaning 'add these 2 lines'). Comments should be in English for consistency and maintainability in an English codebase.
| # TF2 Buffer and Listener for coordinate transformations - この2行を追加 | |
| # TF2 Buffer and Listener for coordinate transformations - Add these 2 lines |
| while map_yaw > math.pi: | ||
| map_yaw -= 2 * math.pi | ||
| while map_yaw < -math.pi: | ||
| map_yaw += 2 * math.pi |
There was a problem hiding this comment.
The angle normalization logic is duplicated here when there's already a normalize_angle utility function imported. Consider using the existing utility function instead of reimplementing the logic.
| while map_yaw > math.pi: | |
| map_yaw -= 2 * math.pi | |
| while map_yaw < -math.pi: | |
| map_yaw += 2 * math.pi | |
| map_yaw = normalize_angle(map_yaw) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.