Hi all
I'm receiving a 'Segmentation fault' after launching the task browser from my OROmain program. The problem occurs after the program calls the method 'browser.loop()'.
I'm using an ATI (Forfe-Torrque sensor) library (libATI.a), and this problem occurs just when I try to use the library method 'createCalibration'. If I take it appart there's no longer segmentation fault. The method receives 2 arguments (char* and unsigned short) and returns a pointer to an structure. What could be the problem?
The terminal output is the following:
0.080 [ Info ][main()] ./exampleOR-gnulinux manually raises LogLevel to 'Info' (5). See also file 'orocos.log'. 0.080 [ Info ][main()] **** Creating the 'Robot' component **** 0.080 [ Info ][Thread] Creating Thread for scheduler: 0 0.080 [ Info ][robot1] Thread created with scheduler type '0', priority 0, cpu affinity 3 and period 0. 0.080 [ Info ][Thread] Creating Thread for scheduler: 0 0.080 [ Info ][GlobalEngine] Thread created with scheduler type '0', priority 0, cpu affinity 3 and period 0. robot constructed ! 0.080 [ Info ][main()] **** Creating the 'FTSensor' component **** 0.080 [ Info ][Thread] Creating Thread for scheduler: 0 0.081 [ Info ][FTSensor1] Thread created with scheduler type '0', priority 0, cpu affinity 3 and period 0. FTSensor constructed ! 0.081 [ Info ][main()] **** Creating the 'Peer' connection **** 0.081 [ Info ][main()] **** Starting the TaskBrowser **** 0.081 [ Info ][Thread] Creating Thread for scheduler: 0 0.081 [ Info ][TaskBrowser] Thread created with scheduler type '0', priority 0, cpu affinity 3 and period 0. Switched to : robot1 0.081 [ Info ][main()] Entering Task robot1 This console reader allows you to browse and manipulate TaskContexts. You can type in an operation, expression, create or change variables. (type 'help' for instructions and 'ls' for context info) TAB completion and HISTORY is available ('bash' like) Use 'Ctrl-D' or type 'quit' to exit this program. Segmentation fault
And the important part of the code regarding the usage of this function in my FTSensor TaskContext is
#define FTS_CALIBRATIONFILEPATH "/home/focke/ECLIPSE/workspace/orocos_ros_pkg/Dorie.cal" char * pCalibrationFilePathFTS; Calibration * pCalibrationFTS; //TaskContext constructor FTSensor(string const& name) : TaskContext(name, PreOperational), sensorState(SENSOR_NOT_INITIALIZED), CANHandleFTS(-1), iCANNetNumber(FTS_CAN_NETNUMBER), iCANNodeId (FTS_CAN_NODEID) { string sCalibrationFilePath = FTS_CALIBRATIONFILEPATH; //creating the c-string pCalibrationFilePathFTS = new char [sCalibrationFilePath.size() + 1]; //copying sCalibrationFilePath to pCalibrationFTS strcpy(pCalibrationFilePathFTS, sCalibrationFilePath.c_str()); Logger::In in("ORP-"+name); if ( log().getLogLevel() < Logger::Info ) { log().setLogLevel( Logger::Info ); log(Info) << "ORP-" << name << " manually raises LogLevel to 'Info' (5). See also file 'orocos.log'."<<endlog(); } this->addOperation("initializeSensor", &FTSensor::initializeSensor, this, OwnThread) .doc("Open the CAN device and sets the CAN communication with the sensor. Returns TRUE if all the operations were done successfully"); std::cout << "FTSensor constructed !" <<std::endl; } //method call pCalibrationFTS = createCalibration(pCalibrationFilePathFTS, 1);
Hope someone can help me
Santiago