ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

error when running executable file on UWSim

asked 2016-06-01 14:55:10 -0500

ZYS gravatar image

updated 2016-06-02 09:18:18 -0500

The example code is including three files which are header file, member function file and main file. And the code is copied from the textbook.

I put the header file on the path:/home/gupta/catkin_ws_2/src/underwater_simulation/uwsim/include/uwsim. 
I put the member function file on the path /home/gupta/catkin_ws_2/src/underwater_simulation/uwsim/src. 
I put the main file on the path: /home/gupta/catkin_ws_2/src/underwater_simulation/underwater_vehicle_dynamics/src

Then I add something in the CMakeList.txt:

add_executable(mainstudent /home/gupta/catkin_ws_2/src/underwater_simulation/underwater_vehicle_dynamics
/src/mainstudent.cpp)

target_link_libraries(mainstudent uwsim ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${BULLET_LIBRARIES})

add_library(uwsim 
...
src/student.cpp
...
)

header file:

class Student
{
public:
    void display();
private:
    int num;
    char name[20];
    char sex;
};

function member file:

#include <iostream>
#include "uwsim/student.h"
using namespace std;

void Student::display()
{
    cout<<"num="<<num<<endl;
    cout<<"name="<<name<<endl;
    cout<<"sex="<<sex<<endl;
}

main file:

#include <iostream>
#include "uwsim/student.h"

int main()
{
    Student stud;
    stud.display();
    return 0;
}

There is no error when compiling the code. However, there is error when running the executable file on the terminal. And the error is shown below:

Loading SimulatedDevices plugin: 'DredgeTool_Factory'
Loading SimulatedDevices plugin: 'ForceSensor_Factory'
Loading SimulatedDevices plugin: 'SimDev_Echo_Factory'
terminate called after throwing an instance of 'pluginlib::LibraryUnloadException'
  what():  According to the loaded plugin descriptions the class ForceSensor_Factory with base class type uwsim::SimulatedDeviceFactory does not exist. Declared types are `enter code here`DredgeTool_Factory ForceSensor_Factory SimDev_Echo_Factory
Aborted (core dumped)

Any suggestion? Thanks so much.

edit retag flag offensive close merge delete

Comments

Please format your question properly: use the Preformatted Text button (with 101010 on it) for all code and console copy/pastes. Right now it's unreadable.

gvdhoorn gravatar image gvdhoorn  ( 2016-06-01 15:38:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-06-06 03:08:15 -0500

Javier Perez gravatar image

Hi,

Having a look at your code files, it seems you are mixing the files in different packages. I'm not sure if something like that is supposed to work but I think there is no need to do it. So why are you putting header and member files in one package (uwsim) and the main file in a different one (underwater_vehicle_dynamics)?. Beyond that the CMakeLists is from uwsim package?, you shouldn't call a file from a different package in a CMakeList (first two lines). Finally if student classes do not work with uwsim core, as far as I can see they do not include a single file from it, there is no need to add them to the same library, I would create a new one for them or even a new package for them and left unmodified the uwsim package.

Anyway code from the new files is simple enough to work, problem is in the way you are building them.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-06-01 14:55:10 -0500

Seen: 433 times

Last updated: Jun 06 '16