NMS Example

An example project with source code that demonstrates how to create an NMS Level #1 navigation robot skill.

+ How To Add This Control To Your Project (Click to Expand)
  1. Make sure you have the latest version of ARC installed.
  2. Select the Get button in this page to download the archive file.
  3. Double click the downloaded archive file to execute installer.
  4. The installer will add this control to ARC.
  5. Load ARC and press the Project -> Add Control button from the menu.
  6. Choose the Navigation category tab.
  7. Press the NMS Example icon to add the control to your project.


An Example Project with source code that demonstrates how to create an NMS Level #1 navigation robot skill. In this robot skill, the NMS scan and location(position) data are displayed. Other than a demonstration of how to code a robot skill to receive NMS data, this is entirely useless :). The code for this example robot skill demonstrates how something like The Navigator could be made. 

Download the source code for this robot skill here: NMS Example

User-inserted image

This robot skill subscribes to an NMS event that contains combined scan and location data. As scan data is added to the NMS, it is accumulated in a buffer. Once a location data is updated in the NMS, the event is raised which contains both the latest position and scan data.

Similar to The Navigator and by referencing the NMS manual, this robot skill will require a (Level #3 Group #2) Location/Position robot skill in order to work. The (Level #3 Group #1) scan data alone does not provide enough information for the robot to determine the location/position. So this robot skill requires some form of a location. Check the NMS manual for more information. Notice how Level #3 Sensor Group #2 is required. Check the NMS manual for sensor group definitions.

User-inserted image

The event is assigned in the loading of the form.


    public MainForm() {


// do not show a config button in the title bar
ConfigButton = false;

// There is a comment on the event method below for this
ARC.MessagingService.Navigation2DV1.Messenger.OnNewLocationPointScanPoints += Messenger_OnNewLocationPointScanPoints;

We unsubscribe from the event when the form is closed.


    private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {

// When the form is closing remove the event
ARC.MessagingService.Navigation2DV1.Messenger.OnNewLocationPointScanPoints -= Messenger_OnNewLocationPointScanPoints;

This event is raised by the NMS when the location point is updated. This event is convenient because it contains both the scan points and location points. The scan points are accumulated until the location point is updated. So all the scan points passed in this event are based on the most recent location.


    private void Messenger_OnNewLocationPointScanPoints(ARC.MessagingService.Navigation2DV1.LocationPointScanPoints locationPointScanPoints) {

// This event "may" block the NMS
// Either run your code in a separate thread -or- make sure your code is super fast and great (optimize compiler as well with a release build)

int closestDistance = int.MaxValue;
int closestDegree = 0;

int furthestDistnace = 0;
int furthestDegree = 0;

foreach (var scanPoint in locationPointScanPoints.ScanPoints) {

if (scanPoint.Distance > 0 && scanPoint.Distance < closestDistance) {

closestDistance = scanPoint.Distance;
closestDegree = scanPoint.Degree;

if (scanPoint.Distance > 0 && scanPoint.Distance > furthestDistnace) {

furthestDistnace = scanPoint.Distance;
furthestDegree = scanPoint.Degree;

$"X: {locationPointScanPoints.LocationPoint.X}" + Environment.NewLine +
$"Y: {locationPointScanPoints.LocationPoint.Y}" + Environment.NewLine +
$"Heading: {locationPointScanPoints.LocationPoint.DegreesHeading}" + Environment.NewLine +
$"Closest Distance: {closestDistance}" + Environment.NewLine +
$"Closest Degree: {closestDegree}" + Environment.NewLine +
$"Furthest Distance: {furthestDistnace}" + Environment.NewLine +
$"Furthest Degree: {furthestDegree}" + Environment.NewLine +
$"Updated: {locationPointScanPoints.LocationPoint.TimeStamp}");