Introducing LabVIEW and the Robot Operating System (ROS)

  Print

"NI's platform approach and LabVIEW's framework allow us to more efficiently design high-level system architecture and algorithms while leveraging open-source code from ROS."

- Chris Rogers, Tufts University Center for Engineering Education and Outreach

The Challenge:
Creating a system-level approach to program robot operating system (ROS) that is both easy for the layperson to program and for the expert to debug.

The Solution:
Developing a platform within the LabVIEW environment that allows communication to and from any robot running the ROS with minimal effort on the part of the programmer.

Author(s):
Chris Rogers - Tufts University Center for Engineering Education and Outreach
Whitney Crooks - Tufts University Center for Engineering Education and Outreach
Phoebe Manning - Tufts University Center for Engineering Education and Outreach
Chris Smith - Tufts University Center for Engineering Education and Outreach

The Center for Engineering Education and Outreach at Tufts University conducts research related to how kids and adults understand and learn engineering, which provides direction for our educational tool development. We look at how to use different robots and programming languages in the classroom to increase student engagement and learning. A common problem we encounter is interfacing between various chips, drivers, and sensors. Prior work at the center interfaced various platforms such as Arduino and Raspberry Pi with LabVIEW to create a more uniform and efficient programming experience that we call BotSpeak. With the abundance of ROSs at academic institutions in the United States and Europe, we decided to build off our previous work to develop an ROS package for LabVIEW.

The ROS Master provides naming and registration services to the other nodes in the ROS as well as tracking publishers and subscribers to different topics and services. The Master enables each node to locate other nodes, and once these nodes have located each other, they may communicate directly. The Master also provides the parameter server. Traditionally, one connects with the Master through a command-line interface (CLI) shell. This method of computing can be difficult for beginners to use because it requires memorizing a library of commands and their syntax, and can be difficult to debug. A solution to the drawbacks of CLI is to develop a GUI (which are widely regarded as being easy to use) in LabVIEW to allow ROS programmers an improved experience and increased productivity.

We developed a LabVIEW client API for communication with ROS applications. With this package, ROSforLabVIEW, users can program the communication of topics and services in LabVIEW and access the Master IP. The client library can handle node-to-node transport negotiation and communication setup using TCP as its transport mechanism as well as handle transport-specific serialization and deserialization of messages. In addition, the client library allows the subscription to a simulated clock, which uses the LabVIEW sense of time.

The current build of ROSforLabVIEW includes a set of VIs that establish a connection to a Master (ROS_Topic_Init.vi), send or receive data from topics or services (ROS_Topic_Write.vi and ROS_Topic_Read.vi, respectively), and code or decode message strings.

When ROS_Topic_Init.vi is first called, a master console VI (_ROSMasterConsole.vi) launches using VI server. The Master Console provides a central location for tracking topics currently running on the LabVIEW hardware target. If it receives a topic that is not currently registered, it will launch an asynchronously running server VI (_BlankServer.vi) for that topic to handle TCP communications with any external consumers of the topic data. That server VI receives a new name based on the topic name. The system also creates a named queue to handle the passing of data between the asynchronous server and the LabVIEW VI acting as a client. This applies to publish and subscriber topics as well as service clients. Additionally, the Master Console serves as a place where the user can launch a VI to ping the robot to ensure everything is working and launch a VI to debug any errors that occur.

Figure 1. The ROS Console provides live information feeds showing connection status, errors, and messages being sent over the network.

The current palette set consists of a subpalette for ROS and one for devices. The ROS subpalette contains basic ROS building blocks like ROS_Topic_Init.vi and ROS_Topic_Read.vi. The subpalettes within ROS contain ROS Primitives, Message Building VIs, and Parsing VIs. Within the ROS Primitive subpalette is _ROSDefinition.vi, a global Message Building VI that includes geometry messages, standard messages, Baxter (the robot) core messages, sensor messages, a time stamp, and a VI for prepending the length of a string. Parsing VIs include geometry messages, standard messages, Baxter core messages, sensor messages, conversions, and several others.

Figure 2. Publisher on the Topic/Chatter

Figure 3. Subscriber on the Topic/Chatter

Figure 4. Service Client on the Topic/Chatter_Back

Currently, the only robot supported in the Device subpalette is Baxter. We designed numerous VIs specifically for Baxter to make it easier to create programs. These include VIs to enable Baxter, set the red and green light levels, read joint positions, move joints based on angle or velocity, as well as reading the cameras, sonar sensors, and infrared sensor. Additionally, several examples are included that demonstrate how to program Baxter using these VIs. Examples include, reading Baxter’s camera, reading the buttons on Baxter’s wrist, and moving his joints, among others.

To date, we have used these VIs to develop both low-level programs, like the examples included in the package, and high-level programs including various sorting tasks. We have programmed Baxter to sort LEGO® MINDSTORMS® kits with more than a 90 percent success rate. He can also match and sort shapes. Both these tasks use the cameras in Baxter’s end effectors to identify objects or shapes based on a predefined object or shape library and then navigate to the object’s or shape’s location for a pick and place task.

We developed a package that helps LabVIEW users interface with ROS through our VIs, so they can initiate topics and services to publish and subscribe to. We also developed a set of VIs specifically for Baxter and demonstrated that these VIs can be used for both low- and high-level tasks. The toolkit with installation instructions can be found below.

Author Information:
Whitney Crooks
Tufts University Center for Engineering Education and Outreach 
200 Boston Avenue 200 Boston Avenue
Medford, MA 02155
Tel: (617) 627-5888
whitney.crooks@tufts.edu

Bookmark and Share


Explore the NI Developer Community

Discover and collaborate on the latest example code and tutorials with a worldwide community of engineers and scientists.

‌Check‌ out‌ the‌ NI‌ Community


Who is National Instruments?

National Instruments provides a graphical system design platform for test, control, and embedded design applications that is transforming the way engineers and scientists design, prototype, and deploy systems.

‌Learn‌ more‌ about‌ NI