This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/IWR1642BOOST: ti_rospackage including class errors

Part Number: IWR1642BOOST
Other Parts Discussed in Thread: IWR1642

Tool/software: TI C/C++ Compiler

Hi,

I am using the ti_mmwave_rospkg and retrieving the x,y,z positions of detected objects is working fine. I would like to add a class to the ros package and run the class methods in the mmWaveQuickConfig.cpp file. When running catkin_make, I keep getting the errors pasted below. The same error also appeared when I tried including the DataHandlerClass.h and creating a new dataHandler like this:

/*
 * mmWaveQuickConfig.cpp
 *
*/

#include "ros/ros.h"
#include "ti_mmwave_rospkg/mmWaveCLI.h"
#include <cstdlib>
#include <fstream>
#include <stdio.h>
#include <regex>
#include "DataHandlerClass.h"

int main(int argc, char **argv)
{
  ros::init(argc, argv, "mmWaveQuickConfig");
  if (argc != 2)
  {
    ROS_INFO("mmWaveQuickConfig: usage: mmWaveQuickConfig /file_directory/params.cfg");
    return 1;
  }
  else
  {
    ROS_INFO("mmWaveQuickConfig: Configuring mmWave device using config file: %s", argv[1]);
  }
  
  ros::NodeHandle n;
  ros::ServiceClient client = n.serviceClient<ti_mmwave_rospkg::mmWaveCLI>("/mmWaveCommSrv/mmWaveCLI");
  ti_mmwave_rospkg::mmWaveCLI srv;
  std::ifstream myParams;
  
DataUARTHandler newHandler(&n);

...

The errors I am getting are:
/home/joe/catkin_wsMA/build/ti_mmwave_rospkg/devel/lib/libmmwave.so:-1: error: undefined reference to `class_loader::class_loader_private::AbstractMetaObjectBase::AbstractMetaObjectBase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/joe/catkin_wsMA/build/ti_mmwave_rospkg/devel/lib/libmmwave.so:-1: error: undefined reference to `nodelet::Nodelet::Nodelet()'
/home/joe/catkin_wsMA/build/ti_mmwave_rospkg/devel/lib/libmmwave.so:-1: error: undefined reference to `nodelet::Nodelet::getPrivateNodeHandle() const'
...
and some more class_loader errors


I am not sure what's wrong. Including the DataHandlerClass.h header file and initialising a new DataUARTHandler in the mmWaveLoader.cpp did not produce any compile errors. Any suggestions how to use the class in both files containing a main method?

Any help is much appreciated.

Ryen

  • Sorry, I didn't mean to add the rest of the question to the bottom line of the code snippet. Also the <strong> tags were not intended, I must have bold formated the code snippet. Here is the remainder of my question.

    The errors I am getting are:
    /home/joe/catkin_wsMA/build/ti_mmwave_rospkg/devel/lib/libmmwave.so:-1: error: undefined reference to `class_loader::class_loader_private::AbstractMetaObjectBase::AbstractMetaObjectBase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /home/joe/catkin_wsMA/build/ti_mmwave_rospkg/devel/lib/libmmwave.so:-1: error: undefined reference to `nodelet::Nodelet::Nodelet()'
    /home/joe/catkin_wsMA/build/ti_mmwave_rospkg/devel/lib/libmmwave.so:-1: error: undefined reference to `nodelet::Nodelet::getPrivateNodeHandle() const'
    ...and some more class_loader errors

    I am not sure what's wrong. Including the DataHandlerClass.h header file and initialising a new DataUARTHandler in the mmWaveLoader.cpp did not produce any compile errors. Any suggestions how to use the class in both files containing a main method?

    Any help is much appreciated.

    Ryen
  • Ryen,

    Thanks for your interest in the TI IWR1642 mmWave Radar sensor. I would be happy to assist.

    The easiest way to use the TI mmWave ROS driver package is to launch the ti_mmwave_rospkg node using the provided "ti_mmwave_sensor.launch" launch file. For IWR1642, the "rviz_1642_2d.launch" launch file is a good example of how to call the "ti_mmwave_sensor.launch" launch file with the desired device parameters. You can then process the output data in your own custom node by subscribing to the "/mmWaveDataHdl/RScan" topic similar to the way the data is being visualized in rviz.

    As far as the build errors you are seeing with your custom code, it may be due to missing header file includes. For example, in the "mmWaveDataHdl.cpp" driver source file where the DataUARTHandler class is normally instantiated both the "DataHandlerClass.h" and "mmWaveDataHdl.hpp" are included at the top of the file. It looks like you are already including "DataHandlerClass.h" but you may be missing the includes in "mmWaveDataHdl.hpp" (including <nodelet/nodelet.h>, etc.).

    Please mark as answered if this resolves the issue or reply with more details if more support is required.

    Regards,
    John
  • John,

    Thank you for your reply. I'm sorry, I think I was not very clear about the compile errors I am getting. Essentially I would like to integrate my own class into the ti_rospackage and use it's methods in the mmWaveQuickConfig.cpp source file. I kept running into compile errors, which is why I tried to understand how the existing DataUARTHandler class is integrated.

    That is when I found that the ros package does not compile when including the DataUARTHandler class into the mmWaveQuickConfig.cpp (producing the same errors as when I tried to include my own class). For some reason the package does compile when including the DataUARTHandler class to the second source file containing a main() method, namely mmWaveLoader.cpp.

    In short, adding this to the clean ti_rospackage compiles:

    /*
    * mmWaveLoader.cpp
    *
    */
    #include "ros/ros.h"
    #include "nodelet/loader.h"
    #include "DataHandlerClass.h"

    int main(int argc, char **argv)
    {

    ros::NodeHandle myNH;
    DataUARTHandler handler(&myNH);

    ...

    But, adding this to the clean ti_rospackage does not compile:
    /*
    * mmWaveQuickConfig.cpp
    *
    */

    #include "ros/ros.h"
    #include "ti_mmwave_rospkg/mmWaveCLI.h"
    #include <cstdlib>
    #include <fstream>
    #include <stdio.h>
    #include <regex>

    #include "nodelet/loader.h"
    #include "DataHandlerClass.h"
    #include "mmWaveDataHdl.hpp"
    #include <nodelet/nodelet.h>

    int main(int argc, char **argv)
    {

    ros::NodeHandle myNH;
    DataUARTHandler handler(&myNH);

    ...

    and produces following compile error:

    [100%] Linking CXX executable /home/joe/catkin_wsMA/devel/lib/ti_mmwave_rospkg/mmWaveQuickConfig
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::AbstractMetaObjectBase::AbstractMetaObjectBase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `nodelet::Nodelet::Nodelet()'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `nodelet::Nodelet::getPrivateNodeHandle() const'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::getFactoryMapForBaseClass(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::getCurrentlyActiveClassLoader()'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::getCurrentlyLoadingLibraryName[abi:cxx11]()'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::AbstractMetaObjectBase::addOwningClassLoader(class_loader::ClassLoader*)'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::getPluginBaseToFactoryMapMapMutex()'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::AbstractMetaObjectBase::~AbstractMetaObjectBase()'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `nodelet::Nodelet::~Nodelet()'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `typeinfo for nodelet::Nodelet'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::AbstractMetaObjectBase::setAssociatedLibraryPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
    /home/joe/catkin_wsMA/devel/lib/libmmwave.so: undefined reference to `class_loader::class_loader_private::hasANonPurePluginLibraryBeenOpened(bool)'
    collect2: error: ld returned 1 exit status
    ti_mmwave_rospkg/CMakeFiles/mmWaveQuickConfig.dir/build.make:126: recipe for target '/home/joe/catkin_wsMA/devel/lib/ti_mmwave_rospkg/mmWaveQuickConfig' failed
    make[2]: *** [/home/joe/catkin_wsMA/devel/lib/ti_mmwave_rospkg/mmWaveQuickConfig] Error 1
    CMakeFiles/Makefile2:1939: recipe for target 'ti_mmwave_rospkg/CMakeFiles/mmWaveQuickConfig.dir/all' failed
    make[1]: *** [ti_mmwave_rospkg/CMakeFiles/mmWaveQuickConfig.dir/all] Error 2
    Makefile:138: recipe for target 'all' failed
    make: *** [all] Error 2


    I really appreciate your help.

    Regards,
    Ryen
  • Ryen,

    Although it may be possible to modify the ti_mmwave_rospkg package by adding custom classes, etc., it is preferred to create your own custom ROS package instead and then use the point cloud messages coming from the ti_mmwave_rospkg node. A tutorial on creating ROS packages can be found in the "Creating a ROS Package" section on wiki.ros.org/.../Tutorials. Creating your own custom package has the advantage of keeping the mmWave sensor driver code separate from your custom code. This will make it easier to develop your own code without dealing with the internal structure and build dependencies of the driver code and allow you to cleanly update the driver code when newer versions are released. It also allows you to record the ROS point cloud messages coming from the mmWave sensor node in ROS bag files and replay them later for your custom node to consume so you can iterate your custom code while replaying the same data capture from the Radar sensor if desired.

    As far as the compile errors seen, it may be due to the internal library/executable partitioning of the mmWave ROS driver and the dependent ROS libraries required to link a standalone executable vs. launching a nodelet. Unfortunately, we are not able to investigate and resolve build issues due to custom code changes.

    Regards,

    John
  • Hi John,

    Thanks for your help. I have now switched to using catkin simple and I am not getting compile errors anymore.

    Ryen