LabVIEW Meca500 Monitoring

     

    In a previous article, we explained how to send commands to the robot. In this article, we will explain how to use the monitoring port to get information about the robot and display them on a LabVIEW front panel.

    Meca500 Monitoring Port

    As mentioned in the previous article, we can send commands to the robot through port 10000. To monitor the status of the robot however, the port 10001 is used. While only one connection to the control port can be created at any time, many connections to the monitoring ports can be created at the same time.


    The robot sends information to the monitoring port at a fixed rate. The default delay is 15ms but can be changed using the command SetMonitoringInterval(n). The information sent to the port is:

    [2016][θ1, θ2, θ3, θ4, θ5, θ6]

    [2017][x, y, z, α, β, γ]

    [2007][as, has, sm, es, pm, eob, eom]


    Again, every message sent by the robot ends with the ASCII null character \x00.

    String Handling in LabVIEW

    To get the status of the robot from the monitoring messages, some string handling is required. The big challenge here is that the messages are not of fixed length and the TCPRead doesn’t allow searching for a specific end of line character. The strategy to extract the messages and contents is:

    1. Use the TCPRead function with a relatively small number of bytes to read. In our example we use 30.

    2. Concatenate the new message with the previous one. This is because the message will not be complete after one read action and even when a message is complete, there is usually some left over data that is part of the next message.

    3. Then we search for the character “\x00” in the string. Here two things can happen:

      1. If we find the character, everything before it is passed along to be parsed. This is a complete message. Anything after the character is part of the next message and is then passed to be concatenated with the next message.

      2. If no character is found, the string is passed on to be concatenated with the next one.

    4. Select which string to parse:

      1. If no new message is passed along to be parsed, the previous one is used

      2. If a new message is passed, it is used instead of the previous one

    5. Find the message code by checking the 4 characters that appear after the first bracket. This is fixed length so it is easy to do with LabVIEW’s string handling functions.

    6. The message code is sent to a case structure as well as the whole message.

    7. For every code, the data is extracted in the same way, only the quantity of data points changes.

    8. Search for a “,” character in the string starting with an offset of 7. The offset is the brackets and code.

    9. Everything after is fed to the next search function and step 8 is repeated with an offset of 1 instead of 7.

    10. All the values extracted are displayed on the front panel.

    Example program

    Connection

    The connection is created outside the while loop and the port 10001 is used. The default IP address is 192.168.0.100.

    TCPRead and message extraction

    This section might look a bit complicated but this is because some LabVIEW functions behave in a very specific way and we need to add some blocks to make it work the way we want.

    This section corresponds to the steps 2-4 described earlier where we read the TCP port and extract the message.

    Message parsing

    The message parsing is fairly simple as it is a cascade of search functions and data conversion functions. For each code number, we parse the message the same way but with different outputs. We also add an empty "Default" case for the codes that we don't want to manage.

    Conclusion

    Monitoring the Meca500 robot on labview can be useful when creating most front panels. For instance if a jogging panel needs to be created, the monitoring is very useful to know if we approach the limits of the joints for instance. It can be a bit difficult to create since the string handling in LabVIEW is not the easiest thing to do, but as shown in this example, it is doable with a little bit of work.

     

    Attachments (1)

    vi

    MonitoringDemo.vi
    25.7 KB