Communicate labjack with ROS ( Robot Operating System ) | LabJack
 

Communicate labjack with ROS ( Robot Operating System )

10 posts / 0 new
Last post
Yogy Pratama
yogypr03's picture
Communicate labjack with ROS ( Robot Operating System )

Hi,

i want to ask you somethink about how to communicate Labjack to ROS, i was buy labjack T7 and now on the way to my place (Indonesia ) . previously I will explain what is ros, "ROS (Robot Operating System) provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, message-passing, package management, and more. ROS is licensed under an open source, BSD license." 

I use Labjack to receive data from various sensors then the data is forwarded to the ROS, then ROS will process the data and forward it back to the Labjack to drive a motor. the communication that I want to use from labjack to ros is with ethernet.

And my question is, do labjack and my question is whether labjack provides a library for communicating with ros ?
Thanks



Regard's
Yogy Pratama

LabJack Support
labjack support's picture
The LJM library communicates

The LJM library communicates with T7s and can be used within ROS. Because ROS can be written in C++ or Python, you can use either the C/C++ or the Python examples to get started:

https://labjack.com/support/software/examples/ljm

Yogy Pratama
yogypr03's picture
does that mean I don't need

does that mean I don't need to use the default labjack application(Kipling) for pin configuration ? And i must do it with C++ on ROS?

LabJack Support
labjack support's picture
You can use Kipling or you

You can use Kipling or you can use C++ on ROS. The Communication page explains:

All T-series device configurations and data is read from and/or written to Modbus register(s). Thus, the process for reading the serial number, an analog input, or a waveform is functionally the same, you simply provide a different address.

Both Kipling and LJM (using C++, for example) understand the same Modbus register names.

Register names for DIO configuration is here:

https://labjack.com/support/datasheets/t-series/digital-io

Yogy Pratama
yogypr03's picture
Labjack T7 just arrived at my

Labjack T7 just arrived at my place. I use linux as an operating system, and I have tried to compile with gcc (C++) but it didn't work

LabJack Support
labjack support's picture
What command did you use?

What command did you use? What was the error output?

If you haven't seen already, the C/C++ examples have a script that can be used to build the examples. Run basic/make.sh, for example:

https://labjack.com/support/software/examples/ljm/c

Yogy Pratama
yogypr03's picture
when I try to add the LJM

when I try to add the LJM_utilities.h library to C ++ (Node ROS) then I try to compile it with ros but it can't, the error say :

 

CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetDeviceType(int)':
testlabjack.cpp:(.text+0x170): undefined reference to `LJM_GetHandleInfo'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `PrintDeviceInfoFromHandle(int)':
testlabjack.cpp:(.text+0x1e5): undefined reference to `LJM_GetHandleInfo'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `PrintDeviceInfo(int, int, int, int, int, int)':
testlabjack.cpp:(.text+0x2d7): undefined reference to `LJM_NumberToIP'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `OpenOrDie(int, int, char const*)':
testlabjack.cpp:(.text+0x39b): undefined reference to `LJM_Open'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `OpenSOrDie(char const*, char const*, char const*)':
testlabjack.cpp:(.text+0x413): undefined reference to `LJM_OpenS'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `CloseOrDie(int)':
testlabjack.cpp:(.text+0x467): undefined reference to `LJM_Close'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `_ErrorCheckWithAddress(int, int, ErrorAction, char const*, __va_list_tag*)':
testlabjack.cpp:(.text+0x515): undefined reference to `LJM_ErrorToString'
testlabjack.cpp:(.text+0x58a): undefined reference to `LJM_ErrorToString'
testlabjack.cpp:(.text+0x5f3): undefined reference to `LJM_CloseAll'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetAndPrint(int, char const*)':
testlabjack.cpp:(.text+0x9d8): undefined reference to `LJM_eReadName'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetAndPrintIPAddress(int, char const*)':
testlabjack.cpp:(.text+0xa65): undefined reference to `LJM_eReadName'
testlabjack.cpp:(.text+0xa88): undefined reference to `LJM_NumberToIP'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetAndPrintMACAddressFromValueAddress(int, char const*, int)':
testlabjack.cpp:(.text+0xb73): undefined reference to `LJM_eAddresses'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetAndPrintAddressAndType(int, char const*, int, int)':
testlabjack.cpp:(.text+0xc62): undefined reference to `LJM_eReadAddress'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetAndPrintConfigValue(char const*)':
testlabjack.cpp:(.text+0xce6): undefined reference to `LJM_ReadLibraryConfigS'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetAndPrintConfigString(char const*)':
testlabjack.cpp:(.text+0xd76): undefined reference to `LJM_ReadLibraryConfigStringS'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `SetConfigValue(char const*, double)':
testlabjack.cpp:(.text+0xdff): undefined reference to `LJM_WriteLibraryConfigS'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `SetConfigString(char const*, char const*)':
testlabjack.cpp:(.text+0xe4d): undefined reference to `LJM_WriteLibraryConfigStringS'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `WriteName(int, char const*, double)':
testlabjack.cpp:(.text+0xeee): undefined reference to `LJM_eWriteName'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `WriteNameAltTypeOrDie(int, char const*, int, double)':
testlabjack.cpp:(.text+0xf5c): undefined reference to `LJM_NameToAddress'
testlabjack.cpp:(.text+0xf96): undefined reference to `LJM_eWriteAddress'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `WriteNames(int, int, char const**, double const*, int*)':
testlabjack.cpp:(.text+0x108a): undefined reference to `LJM_eWriteNames'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `WriteNameArrayOrDie(int, char const*, int, double const*)':
testlabjack.cpp:(.text+0x1119): undefined reference to `LJM_eWriteNameArray'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `WriteNameByteArrayOrDie(int, char const*, int, char const*)':
testlabjack.cpp:(.text+0x11a4): undefined reference to `LJM_eWriteNameByteArray'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `ReadNameArrayOrDie(int, char const*, int, double*)':
testlabjack.cpp:(.text+0x122f): undefined reference to `LJM_eReadNameArray'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `ReadNameByteArrayOrDie(int, char const*, int, char*)':
testlabjack.cpp:(.text+0x12ba): undefined reference to `LJM_eReadNameByteArray'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `CouldNotRead(int, char const*)':
testlabjack.cpp:(.text+0x133b): undefined reference to `LJM_ErrorToString'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `EnableLoggingLevel(double)':
testlabjack.cpp:(.text+0x13a5): undefined reference to `LJM_WriteLibraryConfigS'
testlabjack.cpp:(.text+0x13d0): undefined reference to `LJM_WriteLibraryConfigS'
testlabjack.cpp:(.text+0x1401): undefined reference to `LJM_WriteLibraryConfigS'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetCurrentTimeMS()':
testlabjack.cpp:(.text+0x141e): undefined reference to `LJM_GetHostTick'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `IPToNumber(char const*)':
testlabjack.cpp:(.text+0x1479): undefined reference to `LJM_IPToNumber'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `DoesDeviceHaveWiFi(int)':
testlabjack.cpp:(.text+0x15d3): undefined reference to `LJM_eReadName'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `DisplayDebugLoggingConfigurations()':
testlabjack.cpp:(.text+0x1640): undefined reference to `LJM_ReadLibraryConfigS'
CMakeFiles/testlabjack.dir/src/testlabjack.cpp.o: In function `GetAddressFromNameOrDie(char const*)':
testlabjack.cpp:(.text+0x16ff): undefined reference to `LJM_NameToAddress'
collect2: error: ld returned 1 exit status
 

 

whats that mean ?


 

LabJack Support
labjack support's picture
What was the gcc command? ld

What was the gcc command? ld is the linker, so you have a linker error.

Yogy Pratama
yogypr03's picture
i use command : " catkin_make

i use command : " catkin_make " on terminal for building also compiling .

do you have any tutorial, how to add labjack header library to ROS ?

LabJack Support
labjack support's picture
That's the catkin command,

That's the catkin command, but what's the gcc command? Did the gcc command include a linker step that links to LabJackM?

We don't have a tutorial for ROS and LJM, but we do have the LJM C/C++ examples that I linked to earlier in this thread. Because there are so many programming languages and libraries, we can't make tutorials for all of them, nor can we support build systems for all of them. If you can build LJM using the above LJM C/C++ examples (using the make.sh scripts), that demonstrates a gcc command that successfully builds LJM.