yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
Muto RS Robot📖
01.Introduction to Muto Robot
  • 1.Accessories introduction
  • 2.Precautions for battery
  • 3.FAQ
  • 4.MutoRS Study Guide
  • 5.Quick Start Guide
02.Assembly and write system
  • 1.Raspberry Pi write system
  • 2.Assembly video
03.Remote control course
  • 1.Open and Close APP Control Program
  • 2.Mobile APP Remote Control
  • 3.USB Wireless Controller Remote Control
  • 4.Web Host Computer Remote Control
04.Remote login operation
  • 1.SSH and VNC remote login
  • 2.Jupyter Lab login and running example code
05.AI Large Model Basicsnew
  • 1.AI Large Model Types and Principles
  • 2.RAG Retrieval Enhancement and Model Training Samples
  • 3.Embodied Intelligent Robot System Architecture
  • 4.Embodied Intelligent Functions Core Source Code
06.AI Large Model Developmentnew
  • 1.Register a model service provider account
  • 2.Configure API-KEY
  • 3.Introduction to Dify
  • 4.Dify Basic function
  • 5.AI large model development - Chatbot
  • 6.Deploy the RAG knowledge base
  • 7.RAG knowledge base + Chatbot
  • 8.AI agent workflow
  • 9.Custom wake-up response
  • 10.Core module testing tools
07.AI Large Model (Text Version)new
  • 0.MutoRS Model Setup & Details
  • 1.Semantic Understanding, Instruction Following
  • 2.Multimodal Visual Understanding
  • 3.Multimodal Visual Understanding + Depth Camera Distance Q&A
  • 4.Multimodal Visual Understanding + Visual Line Following
  • 5.Multimodal Visual Understanding + Visual Following
  • 6.Multimodal Visual Understanding + SLAM Navigation
  • 7.Multimodal Visual Understanding + SLAM Navigation + Visual Line Following
  • 8.Intention Estimation + Multimodal Visual Understanding + SLAM Navigation + Visual Functions
08.AI Large Model (Voice Version)new
  • 0.MutoRS Model Setup & Details
  • 1.Semantic Understanding, Instruction Following
  • 2.Multimodal Visual Understanding
  • 3.Multimodal Visual Understanding + Depth Camera Distance Q&A
  • 4.Multimodal Visual Understanding + Visual Line Following
  • 5.Multimodal Visual Understanding + Visual Following
  • 6.Multimodal Visual Understanding + SLAM Navigation
  • 7.Multimodal Visual Understanding + SLAM Navigation + Visual Line Following
  • 8.Intention Estimation + Multimodal Visual Understanding + SLAM Navigation + Visual Functions
09.AI Large Model (Fun Applications)new
  • 1.Versatile performer
  • 2.Action Imitation
  • 3.Problem Solving Expert
  • 4.Exploring Unfamiliar Environments
10.Robot basic course
  • 1)Control buzzer
  • 2)Control PWM servo
  • 3)Control bus servo
  • 4)Robot forward and backward
  • 5)Robot move left and right
  • 6)Robot rotate left and right
  • 7)Control height
  • 8)Control head
  • 9)Action group performance
  • 10)Read data
  • 11)Host computer control
  • 12)Camera driver
11.Voice control coursenew
  • 1.Control Muto motion
  • 2.Control Muto tracking
  • 3.Control Muto color recognition
  • 4.Control Muto color tracking
  • 5.Control multi-point navigation
12.AI vision course
  • 0)Color HSV Calibration
  • 1)Color recognition
  • 2)Color following
  • 3)Color recognition action group
  • 4)Face detection
  • 5)QR code recognition
  • 6)QR code instructions
  • 7)Visual line following
  • 8)Motion learning
  • 9)Synchronous action teaching
13.Mediapipe course
  • 1)Hand detection
  • 2)Attitude detection
  • 3)Overall inspection
  • 4)Face detection
  • 5)Face recognition
  • 6)Face effects
  • 7)Face detection
  • 8)3D object recognition
  • 9)Brush
  • 10)Finger control
  • 11)Gesture recognition
14.Depth camera course
  • 1)Depth camera use
  • 2)Internal reference calibration
  • 3)Web page real-time monitoring
  • 4)ROS+opencv application
  • 5)QR code creation and recognition
  • 6)AR vision
  • 7)Tracking
  • 8)Obstacle recognition
  • 9)Color tracking
  • 10)KCF object tracking
  • 11)RTAB-Map 3D mapping navigation
15.Lidar course
  • 1)About lidar
  • 2)Lidar obstacle avoidance
  • 3)Lidar tracking
  • 4)Lidar guard
  • 5)Patrol
  • 6)SLAM overview
  • 7)ROS2_Gmapping mapping algorithm
  • 8)ROS2_Cartographer mapping algorithm
  • 9)About ROS2 Navigation
  • 10)ROS2 navigation and avoid
  • 11) APP mapping
  • 12)APP navigation
16.Road network navigationnew
  • 1.Road network planning and navigation environment deployment
  • 2.Constructing pose maps
  • 3.Road network annotation
  • 4.Inter-road network planning and navigation
  • 5.Road network navigation under arbitrary poses
  • 6.Path replanning
17.Multi-machine control course
  • 1)Multi-vehicle control
  • 2)Multi-vehicle navigation
18.Robot chassis control
  • 1)Hexapod gait and kinematics
  • 2)Robot information release
  • 3)Robot control
  • 4)URDF model
19.Raspberry Pi course
  • 1)Python usage
  • 2)Use APT to install Python packages
  • 3)Python virtual environment
  • 4)GPIO Zero
  • 5)Pin output high and low levels
  • 6)Pin reads high and low levels
  • 7)Pin output PWM
  • 8)Serial communication
  • 9)I2C communication
20.OpenCV course
  • 1)Introduction to Open Source CV
  • 2)Image reading and display
  • 3)Picture writing
  • 4)Image Quality
  • 5)Pixel operations
  • 6)Image zoom
  • 7)Picture cut
  • 8)Picture pan
  • 9)Picture mirroring
  • 10)Affine transformation
  • 11)Picture rotation
  • 12)perspective transformation
  • 13)Grayscale processing
  • 14)Binary image
  • 15)Edge green detection
  • 16)Line segment drawing
  • 17)Rectangular circle drawing
  • 18)Text and picture drawing
21.Docker course
  • 1)Overview and installation
  • 2)Common commands
  • 3)Deeply understand and publish images
  • 4)Hardware interaction and data processing
  • 5)Enter docker container
  • 6)Robot development environment construction
  • 7)Update docker images
22.ROS2 basic course
  • 1) Introduction to ROS2
  • 2)ROS2 install Humble
  • 3)ROS2 development environment
  • 4)ROS2 workspace
  • 5)ROS2 function package
  • 6)ROS2 node
  • 7)ROS2 topic communication
  • 8)ROS2 service communication
  • 9)ROS2 action communication
  • 10)ROS2 custom interface message
  • 11)ROS2 parameter service case
  • 12)ROS2 meta-function package
  • 13)ROS2 distributed communication
  • 14)ROS2 DDS
  • 15)ROS2 time related API
  • 16)ROS2 common command tools
  • 17)ROS2 rviz2 use
  • 18)ROS2 rqt toolbox
  • 19)ROS2 Launch startup file configuration
  • 20)ROS2 recording and playback tool
  • 21)ROS2 URDF model
  • 22)ROS2 Gazebo simulation platform
  • 23)ROS2 TF2 coordinate transformation
23.Linux basic course
  • 1)Introduction to Linux system
  • 2)Ubuntu file system
  • 3)Ubuntu common commands
  • 4)Ubuntu common editors
  • 5)Ubuntu software operation commands
  • 6)Virtual machine installation
  • 7)SSH remote control
  • 8)VNC remote control
  • 9)Driver library and communication
  • 10)Static IP and hotspot mode
  • 11)Bind device ID
  • 12)Capacity expansion and resource allocation
  • 13)Back up system image
  • 14)Update system software sources
  • 15)Set root user password
  • 16)sudo free password
  • 17)Connect to WiFi network
  • 18)View system version
  • 19)Customized service management
  • 20.Back up system image
24.Mainboard Large Model Course
Offline large model (Text Interaction)
  • 0. AI large model image description
  • 1. Deployment of large AI model environments
  • 2. Installation of large model dialogue platform
  • 3. Meta AI Llama 3.2 model
  • 4. Alibaba Cloud Qwen3 Model
  • 5. Microsoft Phi-4-mini model
  • 6. DeepSeek DeepSeek-R1 model
  • 7. Alibaba Cloud Qwen2.5vl Visual Multimodal Large Model
  • 8. Google Gemma3 Visual Multimodal Large Model
  • 9. Llava Visual Multimodal Large Model
  • 10. MiniCPM-V Visual Multimodal Large Model
  • 11. Multimodal Visual Understanding Applications
  • 12. Multimodal Text-Based Image Application
  • 13. Multimodal Video Analysis Application
  • 14. Multimodal visual positioning applications
  • 15. Multimodal table scanning application
  • 16. Multimodal Autonomous Agent Application
Offline large model (Voice Interaction)
  • 0. Voice Interaction Hardware Connection (Must Read)
  • 1. Offline speech-to-text (ASR)
  • 2. Offline Text-to-Speech (TTS)
  • 3. AI large model voice interaction
  • 4. Multimodal visual understanding and voice interaction
  • 5. Multimodal Text-Based Image Application
  • 6. Multimodal Video Analysis Application
  • 7. Multimodal visual positioning applications
  • 8. Multimodal table scanning application
  • 9. Multimodal Autonomous Agent Applications
  • 10. AI large model offline voice assistant
Online large model (text interaction)
  • 1.OpenRouter Large Model API Aggregation Platform
  • 2. Multimodal Visual Understanding Applications
  • 3. Multimodal visual positioning applications
  • 4. Multimodal table scanning application
  • 5. Multimodal Autonomous Agent Applications
Online large model (voice interaction)
  • 0. Voice Interaction Hardware Connection (Must Read)
  • 1. Online speech-to-text (ASR)
  • 2. Online Text-to-Speech (TTS)
  • 3. AI large model voice interaction
  • 4. Multimodal visual and voice interaction
  • 5. Multimodal visual positioning applications
  • 6. Multimodal table scanning application
  • 7. Multimodal Autonomous Agent Applications
  • 8. AI large model online voice assistant
Download
  • RemoteCtrl_APP(iOS/Android)
  • Mapping_APP(iOS_Android)
  • SystemFile_For_RPi5
  • SystemFile_Jetson
  • SystemFile_RPi
  • Code
  • VM File
  • Hardware Info
  • Instruction Manual
  • Jetson_Boot_USB.tar.gz
  • ROS2_Basic_VM
Download ZIP

Welcome to Muto RS Robot repository

6.Path replanning

Path Replanning

Path Replanning1. Course Content2. Run Path Replanning Case2.1 Start Sensors and Odometry2.3 Start Road Network Planning and Navigation Node3. Query Obstacle Cost Threshold3.1 View Obstacle Cost Value3.2 Modify the Threshold for Triggering Replanning4. Source Code Analysis4.1 Obstacle Detection and Replanning Strategy4.2 Method for Querying Map Cost Value

1. Course Content

  • Basic

    Run the sample program. Based on road network planning and navigation, if the driving path is detected to be blocked during travel, it will enter replanning to find a new path in the road network.

  • Advanced

    1. Understand the implementation method of replanning and how to change the replanning strategy (the strategy is not unique and can be implemented according to your own needs).
    2. Debug and change the obstacle detection threshold based on the queried cost value.

 

This section requires rebuilding the map using a wider and more complex terrain to facilitate replanning.

 

2. Run Path Replanning Case

2.1 Start Sensors and Odometry

  • Open a terminal on the host machine to start the radar fusion node and odometry fusion of the vehicle.
ros2 launch yahboomcar_nav laser_odom_bringup_launch.py

image-20260108093506204

 

2.3 Start Road Network Planning and Navigation Node

  • Start the Kilted container
xxxxxxxxxx
~/kilted_docker_start.sh

 

  • Start the road network planning and navigation node
xxxxxxxxxx
ros2 launch road_net_route roadnet_nav2.launch.py map:=/root/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/road_map.yaml pose_map:=/root/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/road_map roadnet_file:=/root/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/road_map.geojson

[!TIP]

Optional startup parameter description

map The name of the grid map file to be loaded, the default value is map.yaml

pose_map The name of the pose map file to be loaded. When using slam_toolbox pure localization for global navigation, a pose map must be provided.

params_file Navigation parameter file, the default value is os.path.join(get_package_share_directory('road_net_route'), 'config', 'nav2_kilted.yaml')

roadnet_file Road network description file, the default value is /root/map/map.geojson, a full file path must be provided here.

localization_mode Global localization method, the default is slam_toolbox

image-20251127202710855

 

  • The test scenario here is: travel from waypoint 8 to waypoint 6 along the road network, then place an obstacle on the planned path of the road network to trigger the replanning strategy.
xxxxxxxxxx
ros2 topic pub -1 /road_net_nav_id std_msgs/msg/Int16MultiArray "{data: [8, 6]}"

image-20251127205025067.png

 

 

 

  • Here you can see that the terminal will prompt that there is an obstacle on the path, and then trigger replanning.

image-20251127205611749

 

  • After detecting an obstacle on the path and the path is not passable, it returns to the last passed waypoint 8.

image-20251127205823822

 

 

  • Then, it tries to plan a drivable path again from waypoint 8 and then reaches the target waypoint 6.

image-20251127205147761.png

 

 

3. Query Obstacle Cost Threshold

  • The detection of obstacles on the path is determined by checking the cost value on the global path and the number of high-cost points in the global path. The threshold for triggering replanning can be set by yourself.

[!NOTE]

  • The obstacle detection threshold is generally fine with the factory default!!! If you have special scene requirements, you can refer to this part of the tutorial to adjust the threshold for triggering replanning.
  • The cost value is a value in the cost map used to describe the occupied range of an obstacle. The closer to the obstacle, the higher the cost value.

3.1 View Obstacle Cost Value

  • Click the Publish Point tool, and then left-click on the map where you want to view the map cost value to see the cost value of the specified location.

image-20251127211505111

 

  • You can see that the cost value is 0 where there are no obstacles, and the cost value at the center of the obstacle is 99-100.

image-20251127212112982

 

3.2 Modify the Threshold for Triggering Replanning

  • Configuration file path
xxxxxxxxxx
~/code_ws/src/road_net_route/config/nav2_kilted.yaml
  • Find the configuration parameters of the route_bridge node in the configuration file, where COST_THRESHOLD and PATH_OBSTACLES_THRESHOLD together determine the trigger threshold.
xxxxxxxxxx
route_bridge:
  ros__parameters:
    roadnet_file: '/root/map/map.geojson'
    COST_THRESHOLD: 60
    replace2id: True
    PATH_OBSTACLES_THRESHOLD: 5
  • The specific obstacle detection logic is as follows:

  • The global path planned by the road network function is a nav_msgs/msg/Path message type in ROS, which is a path composed of multiple pose points. During road network navigation, it will detect whether all pose points on the global path have high cost values in the global cost map.

    • If the cost value of a certain pose point on the path exceeds the COST_THRESHOLD threshold, the point on the path is marked as a high-cost pose point.
    • Finally, it calculates how many pose points in the global path are high-cost pose points.
    • If the total number of high-cost pose points is greater than PATH_OBSTACLES_THRESHOLD, the path is considered impassable and needs to be replanned.

[!TIP]

If the obstacle detection is not sensitive, you can reduce COST_THRESHOLD and PATH_OBSTACLES_THRESHOLD. If it is too sensitive, you can increase these two values or adjust the inflation radius of the obstacle (to modify the obstacle inflation radius, refer to 4.1 Navigation Controller Debugging in 04-Inter-Road-Network-Planning-and-Navigation).

image-20251127214205383

 

 

 

 

4. Source Code Analysis

  • Implementation source code path:
xxxxxxxxxx
~/code_ws/src/road_net_route/road_net_route/route_bridge.py

 

4.1 Obstacle Detection and Replanning Strategy

  • Traverse each pose point of the global path, check for obstacles exceeding the threshold on the path through the global costmap, and return a boolean value indicating whether the path is blocked by obstacles.
  • World to Map Coordinates: Call the costmap's worldToMapValidated method to convert world coordinates (wx, wy) to the costmap's grid coordinates (mx, my) (the costmap is a 2D grid map, where each grid corresponds to a cost value).
  • Coordinate Validity Check: If the converted grid coordinates are None, it means the path point is outside the global costmap range. A warning log is printed, and the point is skipped.
  • Parameter: path:Path → ROS2's nav_msgs/msg/Path message type, which stores the robot's global planned path, containing a series of poses (poses).
  • Return Value: bool → True indicates the number of obstacles on the path exceeds the threshold; False indicates the path is feasible.
​x
def __check_path_obstacles(self, path:Path)->bool:
    """Check for obstacles on the global path."""
    pose_array=[]
    for pose in path.poses:
        wx=pose.pose.position.x
        wy=pose.pose.position.y
​
        mx, my = self.global_costmap.worldToMapValidated(wx,wy )
        if mx is None or my is None:
            self.get_logger().warn(f"Path point ({wx}, {wy}) is outside global costmap")
            continue
​
        cost = self.global_costmap.getCostXY(int(mx),int(my))
​
        if cost > self.COST_THRESHOLD:
            pose_array.append(pose)
    if len(pose_array) >self.PATH_OBSTACLES_THRESHOLD:
        self.get_logger().info(f"Path contains {len(pose_array)} potential obstacles.")
        return True
    return False

 

  • When an obstacle is detected on the global path, make the robot retreat to the previous waypoint and replan the path.
xxxxxxxxxx
def __reroute_strategy_1(self,last_id):
    '''Replanning Strategy 1: Go back to the previous waypoint and replan the drivable path.'''
    navigator= BasicNavigator()
    goal_x,goal_y=self.__get_node_coordinates(last_id)
    if goal_x is not None and goal_y is not None:
        goal_pose = PoseStamped()
        goal_pose.header.frame_id = "map"
        goal_pose.pose.position.x = goal_x
        goal_pose.pose.position.y = goal_y
        back_lastid = navigator.goToPose(goal_pose)
        while not navigator.isTaskComplete(task=back_lastid):
            time.sleep(0.1)
        if navigator.getResult() == TaskResult.SUCCEEDED:
            self.get_logger().info("back to last id  success.")
        else:
            self.get_logger().info("back to last id  failed.")

 

 

  • handle_id_navigation and handle_pose_navigation are the core code responsible for road network navigation. The following part in both functions is the logic for detecting the path and triggering replanning.

    When an impassable path is detected, Replanning Strategy 1 is called: make the robot retreat to the previous waypoint (coordinates corresponding to last_node_id). The core logic of this method has been explained before: initialize the navigator → get the coordinates of last_node_id → send a navigation task to "retreat to this waypoint" → wait for the task to complete and print the result. This moves the robot from the current obstacle area back to a safe predefined waypoint, providing a stable starting point for subsequent path replanning.

    The complete process is as follows:

    1. The robot normally executes path tracking and gets real-time navigation feedback feedback.

    2. Check if there are obstacles in the path from feedback:

      • If no obstacles: continue on the original path, no action needed.
      • If there are obstacles: trigger the replanning logic.
    3. The robot retreats to the last safe waypoint (last_node_id).

    4. Starting from this waypoint, replan the path to the target waypoint (goal_id).

    5. Get feedback for the new path and have the robot follow the new path to continue moving.

xxxxxxxxxx
if feedback is not None and self.__check_path_obstacles(feedback.path):
    self.__reroute_strategy_1(last_node_id)
    route_task = self.navigator.getAndTrackRoute(last_node_id, goal_id)
    feedback = self.navigator.getFeedback(task=route_task)
    follow_path_task = self.navigator.followPath(feedback.path)

 

xxxxxxxxxx
    def handle_id_navigation(self, start_id:int, goal_id:int):
        '''路点间导航road network ID navigation'''
        
        route_task = self.navigator.getAndTrackRoute(start_id, goal_id)
        feedback=None
        follow_path_task=RunningTask.NONE
        last_feedback = None
        last_node_id =999 
        while not self.navigator.isTaskComplete(task=route_task):
            feedback = self.navigator.getFeedback(task=route_task)
            if feedback is not None and self.__check_path_obstacles(feedback.path):
                self.__reroute_strategy_1(last_node_id)
                route_task = self.navigator.getAndTrackRoute(last_node_id, goal_id)
                feedback = self.navigator.getFeedback(task=route_task)
                follow_path_task = self.navigator.followPath(feedback.path)
            while feedback is not None:
                if  last_feedback is not None and (feedback.last_node_id != last_feedback.last_node_id or feedback.next_node_id != last_feedback.next_node_id):
                    self.get_logger().info(f'id:{feedback.last_node_id} ------> id:{feedback.next_node_id} edge:{feedback.current_edge_id}')
                last_feedback = feedback
                last_node_id=feedback.last_node_id
                if feedback.rerouted : 
                    self.get_logger().info('reroute a new path to follow!')
                    follow_path_task = self.navigator.followPath(feedback.path)
                feedback = self.navigator.getFeedback(task=route_task)
​
            if self.navigator.isTaskComplete(task=follow_path_task):
                print(follow_path_task)
                self.get_logger().info('Controller completed its task!')
                if follow_path_task != RunningTask.NONE :
                    self.navigator.cancelTask()
​
        result = self.navigator.getResult()
        if result == TaskResult.SUCCEEDED:
            self.get_logger().info(Fore.GREEN+"navigation task completed."+Fore.RESET)
            self.action_feedback_pub.publish(String(data="road_net_nav_succeeded"))
        elif result == TaskResult.CANCELED:
            self.get_logger().warn("Navigation task canceled.")
        elif result == TaskResult.FAILED:
            self.get_logger().error("Navigation task failed.")
            self.action_feedback_pub.publish(String(data="road_net_nav_failed"))
​
    def handle_pose_navigation(self, goal_pose:PoseStamped):
        '''处理任意位姿导航 arbitrary pose navigation'''
        transform = self.tf_buffer.lookup_transform("map", "base_footprint", rclpy.time.Time(),rclpy.duration.Duration(seconds=5.0))
        if transform is None:
            self.get_logger().info(Fore.RED+"Failed to get TF transform "+Fore.RESET)
            return
​
        else:
            start_pose = PoseStamped()
            start_pose.header = transform.header
            start_pose.pose.position.x = transform.transform.translation.x
            start_pose.pose.position.y = transform.transform.translation.y
            start_pose.pose.orientation = transform.transform.rotation
            self.get_logger().info(Fore.CYAN + f"current:{transform.transform.translation}"+Fore.RESET)
            nearest_start_node_id, nearest_start_distance = self.__find_nearest_node(start_pose.pose.position.x, start_pose.pose.position.y)
            nearest_goal_node_id, nearest_goal_distance = self.__find_nearest_node(goal_pose.pose.position.x, goal_pose.pose.position.y)
            if self.replace2id:
                self.get_logger().info(Fore.CYAN + f"nearest_start_node_id:{nearest_start_node_id}, distance:{nearest_start_distance}"
                                    f"\nnearest_goal_node_id:{nearest_goal_node_id}, distance:{nearest_goal_distance}"+Fore.RESET)
                route_task = self.navigator.getAndTrackRoute(start=nearest_start_node_id,goal=nearest_goal_node_id)
            else:
                route_task = self.navigator.getAndTrackRoute(start=start_pose,goal=goal_pose,use_start=True)
                
            feedback=None
            follow_path_task=RunningTask.NONE
            last_feedback = None
            last_node_id =999 
            while not self.navigator.isTaskComplete(task=route_task):
                feedback = self.navigator.getFeedback(task=route_task)
                if feedback is not None and self.__check_path_obstacles(feedback.path):
                    self.__reroute_strategy_1(last_node_id)
                    route_task = self.navigator.getAndTrackRoute(last_node_id, nearest_goal_node_id)
                    feedback = self.navigator.getFeedback(task=route_task)
                    follow_path_task = self.navigator.followPath(feedback.path)
                while feedback is not None:
                    if  last_feedback is not None and (feedback.last_node_id != last_feedback.last_node_id or feedback.next_node_id != last_feedback.next_node_id):
                        self.get_logger().info(f'id:{feedback.last_node_id} ------> id:{feedback.next_node_id} edge:{feedback.current_edge_id}')
                    last_feedback = feedback
                    last_node_id=feedback.last_node_id
                    if feedback.rerouted :  
                        self.get_logger().info('reroute a new path to follow!')
                        follow_path_task = self.navigator.followPath(feedback.path)
                    feedback = self.navigator.getFeedback(task=route_task)
​
                if self.navigator.isTaskComplete(task=follow_path_task):
                    self.get_logger().info('Controller completed its task!')
                    if follow_path_task != RunningTask.NONE :
                        self.navigator.cancelTask()
​
            result = self.navigator.getResult()
            if result == TaskResult.SUCCEEDED:
                if self.__adjust_pose(goal_pose):
                    self.get_logger().info(Fore.GREEN+"navigation task completed."+Fore.RESET)
                    self.action_feedback_pub.publish(String(data="road_net_nav_succeeded"))
​
            elif result == TaskResult.CANCELED:
                self.get_logger().info(Fore.YELLOW+"navigation task canceled."+Fore.RESET)
​
            elif result == TaskResult.FAILED:
                self.get_logger().info(Fore.RED+"navigation task failed."+Fore.RESET)
                self.action_feedback_pub.publish(String(data="road_net_nav_failed"))

 

4.2 Method for Querying Map Cost Value

  • Call the global costmap's worldToMapValidated method to convert world coordinates (x, y) to the costmap's grid coordinates (mx, my).
  • The costmap is a 2D grid map (each grid corresponds to a small area in the real world, 0.05m×0.05m). worldToMapValidated is a safe conversion method: if the coordinates are outside the costmap range, it returns None, avoiding out-of-bounds errors from direct conversion.
  • Get Cost Value: Call the costmap's getCostXY method, passing the integer form of the grid coordinates (grid coordinates are discrete integers, avoiding errors from floating-point input), to get the cost value cost of that grid.
xxxxxxxxxx
    def get_costmap_value(self, msg:PointStamped):
        '''In RViz, you can click to view the cost of a point on the global cost map.'''
        x=msg.point.x
        y=msg.point.y
        mx, my = self.global_costmap.worldToMapValidated(x, y)
        if mx is None or my is None:
            self.get_logger().warn(f"Path point ({x}, {y}) is outside local costmap")
            return
        cost = self.global_costmap.getCostXY(int(mx),int(my))
        self.get_logger().info(f"clicked_point in global_costmap cost:{cost}")

 

 

Road network navigation under arbitrary poses
Multi-vehicle control

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文