Page tree
Skip to end of metadata
Go to start of metadata

This document introduces the demo project of "recover_localization", how to call the recoverlocalization() API to have the robot re-position to the correct localization on the map. Before using this feature, please note the following:

1.The success rate of relocalization is related to the environment. Before re-positioning, it is recommended to use a clear environmental map with a sharp outline.

2.For the case where there is a similar environment in the map area, for example, there are offices 1 and 2 with the same environment layout on the map, if the robot is actually in the office 1, it may relocate to the office 2 during the relocalization process. . In this case, it is recommended to modify the office environment to make a distinction on the map when building the map (moving tables and chairs, adding pots, etc.).


IDE Preparation 

  • Software

    • Visual Studio 2010  SP1
    • Slamware Windows SDK:Slamware Windows SDK
    • RoboStudio(for map display):Robostudio installer 
    • Sample Code: 

      Higher version of Visual Studio will cause errors. sometime you will need to upgrade SP1 package to make your VS compatable with .Net Framework.

  • Hardware

          (Either one of following)

    • Slamware SDP mini 
    • Slamware SDP
    • Slamware Kit 
    • Zeus/Apollo robot base




  1. Right click on "recover_localization" project, set as StartUp project.

  2. Right click on "recover_localization", then " Properties",configure "include" and "lib" directories to the corresponding folder path of Slamware SDK.

    Slamware SDK的include和lib目录无需复制到参考例程目录,只需在Visual Studio里指定路径即可。

  3. Right click on "recover_localization", then "properties",set "Command Arguments"  as follows:  
    Syntax :recover_localization <IP address>

  4. Click " F5" to execute.
  5. Robot motion and map could be seen on Robostudio.


  • When the actual position deviates from the theoretical position of the map,  the demo project will start re-positioning operation. If the recover is successful, you can see in the robostudio that the robot re-positions to the correct position and the status will turn to the corresponding one.

    		SlamwareCorePlatform sdp = SlamwareCorePlatform::connect(ip_address, 1445);
    		std::cout <<"SDK Version: " << sdp.getSDKVersion() << std::endl;
    		std::cout <<"SDP Version: " << sdp.getSDPVersion() << std::endl;
    		rpos::actions::MoveAction action = sdp.getCurrentAction();
    		if (action)
    		//recover localization by giving an rectangle area; (0,0,0,0) represents the entire map area.
    		action = sdp.recoverLocalization(rpos::core::RectangleF(0,0,0,0));
    			switch (action.getStatus())
    				case rpos::core::ActionStatusError:
    				std::cout << "Action Failed: " << action.getReason() << std::endl;
    				case rpos::core::ActionStatusRunning:
    				std::cout <<"Current status: Running" << std::endl;
    				case rpos::core::ActionStatusFinished:
    				std::cout <<"Current status: Finished" << std::endl;
    				default :
    				std::cout <<"Status Unknown" << std::endl;