iCub-main
Loading...
Searching...
No Matches
stereoCalibModule.cpp
Go to the documentation of this file.
1#include "stereoCalibModule.h"
2#include <yarp/os/Stamp.h>
3#include <yarp/os/Os.h>
4
5
6
7bool stereoCalibModule::configure(yarp::os::ResourceFinder &rf)
8{
9 moduleName=rf.check("name",Value("stereoCalib"),"module name (string)").asString().c_str();
10 setName(moduleName.c_str());
11
12 handlerPortName="/";
13 handlerPortName+=getName(rf.check("CommandPort",Value("/cmd"),"Output image port (string)").asString());
14
15 char dirName[255];
16 bool proceed=true;
17 string dir=rf.getHomeContextPath().c_str();
18
19 for (int i=1; proceed; i++)
20 {
21 sprintf(dirName,"%s/%s_%.5d",dir.c_str(),"calibImg",i);
22 proceed=!yarp::os::stat(dirName);
23 sprintf(dirName,"%s/%s_%.5d/",dir.c_str(),"calibImg",i);
24 }
25 yarp::os::mkdir_p(dirName);
26
27 if (!handlerPort.open(handlerPortName.c_str()))
28 {
29 cout << ": unable to open port " << handlerPortName << endl;
30 return false;
31 }
32 attach(handlerPort);
33
34 calibThread=new stereoCalibThread(rf,&handlerPort,dirName);
35 calibThread->start();
36
37 return true;
38}
39
40
42{
43 calibThread->stopCalib();
44 calibThread->stop();
45 return true;
46}
47
48
50{
51 calibThread->stop();
52 delete calibThread;
53
54 return true;
55}
56
57
58bool stereoCalibModule::respond(const Bottle& command, Bottle& reply)
59{
60 if (command.get(0).asString()=="start") {
61 reply.addString("Starting Calibration...");
62 calibThread->startCalib();
63 }
64 return true;
65}
66
67
69{
70 return true;
71}
72
73
75{
76 return 0.1;
77}
78
79
bool respond(const Bottle &command, Bottle &reply)
bool configure(yarp::os::ResourceFinder &rf)