Example Code

Access Obstacle or Environmental Properties in the Robotics Module During a Simulation

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Robotics Module

Code and Documents

Attachment

Description

Summary

This example will programmatically get a reference to the first obstacle in the Manifest file and modify one of its properties during execution, as well as modify a simulation property.

 

Overview

The Robotics Module saves information regarding the simulation scene in a Manifest file. This file contains references to the robots and obstacles that will populate this scene.

The easiest way to create a manifest file is to use the wizard; while permanent modifications to the simulation file may be done via the Offline Execution Vis, we can take the approach in this example to temporarily change an object’s property such as a position.

 

In order to do so, this example will load up the reference to a manifest file and access the simulator engine via a property node. The Obstacles are picked and indexed in order to access the first one; should the manifest file have more than one obstacle, you must simply switch the input to the Index Array. A property node gets the ID for the obstacle as a string which is then passed to the Get Obstacle Reference polymorphic VI. You may alternatively wire the string directly if the ID of the obstacle is known.

 

In what concerns changing the world’s properties, the matter is similar. A reference to the world is passed from the Simulator Engine property node, and modified with a different property node. 

 

Steps to Implement or Execute Code

  1. Create a Manifest file with the wizard. Please look at the article for more information regarding this step
  2. Enter the name of the manifest file in the string control
  3. Run the VI
  4. Click on the Boolean when the simulation is displayed
  5. Enter a number for either the Linear Velocity or Gravity Controls

 

VI Snippet

Robotics_Simulation_Access_Obstacle.png

 

Requirements

Software

LabVIEW 2012 with the Robotics Module.

 

Additional Images

Front Panel

 

Robotics_Simulation_Access_Obstacle_FP.png

National Instruments
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.