📜 ⬆️ ⬇️

LabView in robotics - creating a SCADA system to control the robot

image


Good afternoon, dear habravchane!

What is LabView and what is it eaten with?

LabView is a cross-platform graphical development environment developed by National Instruments. LabView is widely used in data acquisition systems, as well as for managing technical objects and technological processes.
')
image

A distinctive feature of LabView is the "sharpened" environment for developing under the "iron". A large number of libraries designed to interact with equipment from different manufacturers allows you to very quickly and comfortably prototype solutions to various tasks, including for controlling robots and machine vision systems. In addition to the official LabVIEW Robotics Module, offered by National Instruments, and containing libraries for interacting with various robotic components, enthusiasts themselves develop a large number of libraries and, what is most valuable, distribute them free of charge. Today, you can see a large number of solutions in robotics with the use of LabView - in our country one of the brightest lately - the Autonomous robot of the NAMT team at Robocross 2013 and Eurathlon 2013.

How it all began

I am a graduate of MSTU. N. Bauman and fond of robotics, although the main focus of my work is industrial automation. When I got acquainted with LabView several years ago, I fell in love with this environment, and since then I have been trying to use it wherever possible. Currently, in addition to using LabView in various projects, I am engaged in conducting elective classes and laboratory work for students related to the use of LabView in data acquisition systems. Recently, thanks to our robot center, I managed to get robotic kits for using them for various scientific purposes. In this regard, I would like to publish a series of works related to the use of LabView in robotics, and the main focus will be on the implementation of the simplest examples, for further use in conducting laboratory work for students. Not so long ago, I was offered to deal with a robotic designer from the Korean firm Robotis and to develop a few simplest examples on LabView to interact with this designer. Of particular interest was the fact that the exchange of data needed to be organized via the Zigbee wireless interface. As prototypes I got OLLO BUG and Bioloid STEM kits.

Kit Contents OLLO BUG
image


The composition of the set Bioloid STEM
image


A distinctive feature of OLLO are more “simple” components in comparison with Bioloid. In particular, the CM-100 controller is part of the OLLO kit, while the CM-530 is supplied with the Bioloid kit.

SM-100
image


CM-530
image


A bunch of native adapters supplied by Robotis were used to organize the wireless interface:
1. ZIG-100 / 110A - is connected to the controller (the one with the tail) and installed on the adapter (which is made in the form of a chip).
ZIG-100 / 110A
image

2. ZIG2Serial - a scarf, in fact, is an adapter with a zigbee module to a standard rs-232.
ZIG2Serial
image

3. USB2Dynamixel is a very interesting and useful thing. It can work in 3 modes - TTL, RS485, RS232 - our option. We use this adapter as an adapter from USB to RS232.
USB2Dynamixel
image


As a result, the following construction was obtained:
image

It remains for the small - to establish a connection between the two halves of the ZIG-100 / 110A and go to moving the squares on the implementation screen of the examples on LabView. This is done with the help of the “native” program - RoboPlus Manager and the process itself is described in great detail on the developer’s website.
In order for our controllers to understand that a ZigBee module is connected to them and to exchange data between them and the peripherals connected to them, it was necessary to write the corresponding firmware for them. The firmware was written using the native RoboPlus Task. The process of writing the firmware is as follows:
image
Since it is impossible to pull out the firmware code in a pleasant and compact form for the eye from the RoboPlus Task, I will not upload the firmware screens in the future. Moreover, the development process itself is quite intuitive and does not cause any special problems. If someone is interested in the firmware itself, I will add them in the .tsk format.
Initially, it was implied that I would have to develop the library myself to work with ZIG2Serial, but after digging on the official Robotis website, I discovered the Zigbee SDK, which was seamlessly integrated into LabView via the classic Import Shared Library (.dll). I conducted this process on LV2010 and LV2012 - no integration problems were found. As a result, we have another palette in User Libraries:

image

To demonstrate the capabilities of LabView, it was decided to use the following examples as training examples:
1. Sending control commands to the controller via the Zigbee interface.
2. Interrogation of the array of infrared sensors connected to the controller.
3. Interrogation of infrared sensors.
4. Interaction with servo drives Dynamixel.

So let's start in order:
1. Sending control commands to the controller via the Zigbee interface.

By control commands in this example, I mean commands that the controller perceives as commands sent from the RC-100 remote control, but nothing prevents us from sending any others - just in this case we would have to modify the firmware further.
RC-100 remote control diagram and codes corresponding to each button
image

The principle of operation in this case is the following - it is connected via com-port to the adapter, and we transfer data to the controller. The controller interprets them and sends the appropriate commands to the robot servos.

Vi development process
We implement this program in several stages.
1. Create a new block diagram. Place on it 2 Case Structure structures, a Round LED indicator with the name ZGB_Connected, and a Square LED indicator with the name TxD_LED. Create an OK Button with the name ZGB_Connect and connect it to the Case Selector input of the first structure. Set the behavior of this Mechanical Action button to Switch Until Released. Place a Flat Sequence structure with three windows (Frame) inside this structure in the True window.
2. Place the zgb_terminate.vi function from the Zigbee library inside the first window. This should be done to close the session with the COM port, in the case when the previous session was not completed correctly. Also in this window we place the local variable ZGB_Connected and assign it the value FALSE.
3. In the next window, we place the function zgb_initialize.vi which we connect the input to the numeric control COM Port, and then compare the output with the value “0”, send the input Enable express-vi Display Msg to the input. In the Message to Display window, we write Initialization Failed. In this window, the connection with the COM port to which the ZIG-100 module is connected using the ZIG2Serial and USB2Dinamixel will be initialized. In case of successful initialization of the connection, the function zgb_initialize.vi returns the value 1, and if not successful, the value 0 and the message of unsuccessful initialization.
4. In the last window we place the Case Structure structure, connecting its input with the OK express-vi Display Msg output. In the True window, put the False constant, and in the False window, the True constant and connect them with the ZGB_Connected indicator.
5. Create an OK Button with the name Transmit. Set the behavior of this Mechanical Action button to Switch Until Released. Now let's move on to the second of the two Case Structure structures created at the beginning. Let us input the structure of the variable value ZGB_Connected using a local variable. Inside the window, True, put a while loop loop. Inside the loop we place the Case Structure structure, the input of which is connected to the Transmit button.
6. Inside the structure, we place the function zgb_tx_data.vi, the input of which will be connected to the numeric control data to transmit, and the output, comparing with the value “0”, will be sent to the input Enable express-vi Display Msg located outside the structure. In the Message to Display window, write Transmission Failed. Also inside the True window of the current Case Structure, we assign the local variable TxD_LED to true. This step is required to send data through the Zigbee interface.
7. In the False window of the current Case Structure, we place another Case Structure, inputting the value of the local variable TxD_LED, and place the function zgb_tx_data.vi in ​​its window True, with the input value “0”. This is necessary for filtering re-sending commands.
8. Create a While Loop loop and place our entire block diagram inside it. Create a Stop button and set its behavior to the Switch When Released position. Connect the Stop and Loop Condition button of the last While Loop loop created. Also inside the current While Loop loop, we place the Case Structure structure in its True window and place the zgb_terminate.vi function. We connect the input structure with the Stop button.
9. Return to the first While Loop loop created. By combining the local variables stop and ZGB_Connect with the logical OR operation, we combine the result of the operation with the Loop Condition of this cycle.


As a result, for this example, the block diagram is as follows:
image
and front panel:
image

2. Interrogation of the array of infrared sensors connected to the controller.

A sensor array of IR SENSOR ARRAY sensors can be connected to the CM-530 controller.
IR SENSOR ARRAY
image

As an example, we will interrogate the sensor of interest to us on demand.
The principle of operation in this case is the following - it is connected via the com-port to the adapter, we send the number of the sensor of interest to the controller - in response we get the value from it.

Vi development process
To perform this exercise, we modify the previous vi in ​​the following way:
1. Clear the first While Loop loop we created from the contents.
2. Create inside it a Case Structure structure and a control (control) named Request. Connect this control to the input of the Case Structure.
3. In the True window, place the Flat Sequence structure with three windows (Frame). Place the zgb_tx_data.vi function from the Zigbee library inside the first window. In this case, this function sends the number of the sensor of interest from the array to the controller. Therefore, we will create a control (control) with the name Sensor number and an indicator with the name Error code of the request and connect them respectively to the input and output of this function.
4. Inside the second window we place the function zgb_rx_data.vi. This function is responsible for receiving this computer through the Zigbee interface. Create an indicator with the name of the result and connect it with the output of the function, passing through the 3rd window of the Flat Sequence structure. In the third window we place the function zgb_rx_check.vi. This function is responsible for displaying the results. Let's create the same indicator Error code of receipt and connect it with the output of this function.


As a result, the block diagram looks like this:
image
and front panel:
image

3. Interrogation of infrared sensors.

In addition to the array of IR sensors, separate IR Sensor can be connected to the controllers.
IR Sensor
image

The implementation of this example is not significantly different from the implementation of the previous one, so I will allow myself not to dwell on the development process, I will just show what happened in the end.

The block diagram is as follows:
image
front panel:
image

4. Interaction with servo drives Dynamixel.

The Bioloid STEM kit includes 2 Dynamixel AX-12A servos, and you can work with them in 2 modes - Joint and Wheel. In Wheel mode, the servo acts as a rotating motor, the main indicator is the speed of rotation. In Joint mode, the servo drive plays the role of a hinge, the main indicator of which is the deviation of a certain value from its initial position. Modes are switched through RoboPlus Manager. A distinctive feature of this example is the continuous exchange with the controller via the Zigbee interface. For this purpose, parallel working loops while loops were added to the block diagram. After selecting the operating mode (rotation of the drives or control of their deviations), the controller continuously sends data representing integer values ​​from 1 to 1023. For Wheel mode, this data is the speed value, and for Joint mode, the value of the actuator position deviation from zero.

The block diagram is as follows:
image
front panel:
image

As a result, these examples were included in the courses on the fundamentals of robotics offered by us.

Conclusion

Well, in conclusion, I would like to say that the development of quite primitive examples has not ended the matter. For a “quick” familiarization with the sets, a demo application was developed, which includes “brought to mind” features based on the above examples, as well as advanced features for controlling and setting up servo drives in the “wired” mode of operation.

image
image
image
image
image
image
image

The main source of information in the development was www.robotis.com - the official website of the manufacturer.

Source: https://habr.com/ru/post/223395/


All Articles