[IGSTK-Users] PolarisTrackerExample Linking Error
Jiwon Jamie Ryu
jjamieryu at melab.snu.ac.kr
Wed Aug 3 23:09:53 EDT 2011
Patrick.
Here it is.
Thanks for your time.
Jamie.
On Thu, Aug 4, 2011 at 11:58 AM, Patrick Cheng <patrick.p.cheng at gmail.com>wrote:
> Jiwon
>
> 24601373203.280037 : (WARNING) NDI Error 0x08: Invalid port handle selected
>
> it looks like tracker tool setup probably has some problem. Can you send me the code for that part?
>
>
> Patrick
>
> On Wed, Aug 3, 2011 at 10:48 PM, Jiwon Jamie Ryu <
> jjamieryu at melab.snu.ac.kr> wrote:
>
>> Hello...
>>
>> Thank you Patrick for the help.
>> Including ITK and IGSTK made it work.
>>
>> I finally got the polaris tracker to work. It does initialize and get the
>> correct rom file.
>> However, when I track the tracker tool, I get position of (0,0,0).
>>
>> What I want to do is I want to get 2 tracker tool positions and transform
>> them to another coordinate space which may already be defined.
>> To do this, I need to get positions of tracker tools.
>>
>> It seems that transform.IsValidNow() is false, so that the code does not
>> go into this loop.
>>
>> tracker->RequestStartTracking();
>>
>> igstk::PulseGenerator::CheckTimeouts();
>> coordSystemAObserver2->Clear();
>> trackerTool2->RequestGetTransformToParent();
>> //trackerTool2->RequestComputeTransformTo( referenceTool );
>> // trackerTool2->ObserveTransformEventsFrom( trackerTool2 );
>> if (coordSystemAObserver2->GotTransform())
>> {
>> transform = coordSystemAObserver2->GetTransform();
>> if ( transform.IsValidNow() )
>> {
>> position = transform.GetTranslation();
>> ...}}
>>
>> I am working on this for so long, but I can't figure it out.
>> I am attaching my logfile just in case.
>> Please help.
>>
>> Thank you in advance.
>>
>> Jamie.
>> On Thu, Aug 4, 2011 at 5:14 AM, Patrick Cheng <
>> patrick.p.cheng at gmail.com> wrote:
>>
>>> Hi Jiwon Jamie Ryu,
>>>
>>> Try to include this in your CMakeLists.txt
>>>
>>> FIND_PACKAGE (ITK)
>>> IF (ITK_FOUND)
>>> INCLUDE (${ITK_USE_FILE})
>>> ELSE (ITK_FOUND)
>>> MESSAGE (FATAL_ERROR "Need ITK.")
>>> ENDIF (ITK_FOUND)
>>>
>>>
>>> Patrick
>>>
>>> On Tue, Aug 2, 2011 at 10:17 AM, Jiwon Jamie Ryu <
>>> jjamieryu at melab.snu.ac.kr> wrote:
>>>
>>>> Hi all.
>>>>
>>>> I'm trying to set up a new solution regarding Polaris tracker, and I'm
>>>> trying to use the functions that are in PolarisTracker.cxx in IGSTKSandbox
>>>> example.
>>>> So I start up with writing CMakeLists.txt shown as below.
>>>> Then, I used Cmake to configure and generate a solution. (Code added is
>>>> the ones that I have written for other program and I'm trying to combine
>>>> everything that I've got.)
>>>> But when I compile the solution, I keep getting about 400 errors as:
>>>>
>>>>
>>>> 1>IGSTKSandbox.lib(igstkTracker.obj) : error LNK2001:
>>>> "__declspec(dllimport) public: unsigned long __thiscall
>>>> itk::Object::AddObserver(class itk::EventObject const &,class itk::Command
>>>> *)" (
>>>> __imp_?AddObserver at Object@itk@@QAEKABVEventObject at 2@PAVCommand at 2@@Z)
>>>> 1>IGSTKSandbox.lib(igstkTrackerTool.obj) : error LNK2001:
>>>> "__declspec(dllimport) public: unsigned long __thiscall
>>>> itk::Object::AddObserver(class itk::EventObject const &,class itk::Command
>>>> *)" (
>>>> __imp_?AddObserver at Object@itk@@QAEKABVEventObject at 2@PAVCommand at 2@@Z)
>>>> 1>IGSTKSandbox.lib(igstkCoordinateSystemDelegator.obj) : error LNK2001:
>>>> "__declspec(dllimport) public: unsigned long __thiscall
>>>> itk::Object::AddObserver(class itk::EventObject const &,class itk::Command
>>>> *)" (
>>>> __imp_?AddObserver at Object@itk@@QAEKABVEventObject at 2@PAVCommand at 2@@Z)
>>>>
>>>> I'm thinking it relates to IGSTKSandbox Linking problem, but I don't
>>>> know what.
>>>> Please help me out.
>>>> Thanks.
>>>>
>>>> Jamie.
>>>> ========================================
>>>> INCLUDE (${IGSTK_USE_FILE} )
>>>> ELSE (IGSTK_USE_FILE)
>>>> MESSAGE( FATAL_ERROR "This application requires IGSTK. One of these
>>>> components is missing. Please verify configuration")
>>>> ENDIF (IGSTK_USE_FILE)
>>>>
>>>>
>>>> INCLUDE_DIRECTORIES(
>>>> ${IGSTKSandbox_SOURCE_DIR}/IGSTK/Source
>>>> ${IGSTKSandbox_SOURCE_DIR}/Source
>>>> ${IGSTKSandbox_BINARY_DIR}
>>>> ${IGSTKSandbox_BINARY_DIR}/SourceLatest
>>>> )
>>>>
>>>> IF(WIN32)
>>>> LINK_LIBRARIES(
>>>> AdeptTcpServer
>>>> IGSTKSandbox
>>>> )
>>>> ENDIF(WIN32)
>>>> INCLUDE_DIRECTORIES(./)
>>>> INCLUDE_DIRECTORIES(./PolarisHandler)
>>>> #INCLUDE_DIRECTORIES(E:/TK/IGSTKBIN2)
>>>> INCLUDE_DIRECTORIES(E:/TK/Sandbox-4-4/Sandbox-4.4)
>>>> #
>>>> # This option enables the scene graph observer to collect relavant
>>>> events to constuct the scene graph tree
>>>> #
>>>> OPTION(IGSTK_USE_SceneGraphVisualization "Enable scene graph
>>>> visualization by allowing the observer to listen to
>>>> relevant events" ON)
>>>> IF(IGSTK_USE_SceneGraphVisualization)
>>>> INCLUDE_DIRECTORIES(
>>>> ${IGSTKSandbox_SOURCE_DIR}/Utilities/SceneGraphVisualization)
>>>> ENDIF(IGSTK_USE_SceneGraphVisualization)
>>>>
>>>>
>>>> SET(Adept_SRC
>>>> RobotTestV1.rc
>>>> AdeptServerTest.cpp
>>>> RobotTestV1.cpp
>>>> RobotTestV1Dlg.cpp
>>>> stdafx.cpp
>>>> )
>>>> SET(Adept_HRD
>>>> AdeptServerTest.h
>>>> AdeptTcpServer.h
>>>> resource.h
>>>> RobotTestV1.h
>>>> RobotTestV1Dlg.h
>>>> stdafx.h
>>>> targetver.h
>>>> )
>>>> SET(Polaris_SRC
>>>> PolarisTracker.cxx
>>>> )
>>>> SET(PolarisHandler
>>>> ./PolarisHandler/APIStructures.h
>>>> ./PolarisHandler/Comm32.cpp
>>>> ./PolarisHandler/Comm32.h
>>>> ./PolarisHandler/CommandConstruction.cpp
>>>> ./PolarisHandler/CommandHandling.cpp
>>>> ./PolarisHandler/CommandHandling.h
>>>> ./PolarisHandler/Conversions.cpp
>>>> ./PolarisHandler/Conversions.h
>>>> ./PolarisHandler/Conversions.cpp
>>>> ./PolarisHandler/Conversions.h
>>>> ./PolarisHandler/INIFileRW.cpp
>>>> ./PolarisHandler/INIFileRW.h
>>>> ./PolarisHandler/MELAB_PolarisHandler.cpp
>>>> ./PolarisHandler/MELAB_PolarisHandler.h
>>>> ./PolarisHandler/SystemCRC.cpp
>>>> )
>>>>
>>>> ADD_EXECUTABLE(Polaris_Robot WIN32 ${Adept_SRC} ${Adept_HRD}
>>>> ${Polaris_SRC} ${PolarisHandler})
>>>> TARGET_LINK_LIBRARIES(Polaris_Robot IGSTKSandbox)
>>>> ==============================================
>>>> *-----------------------------------------------------------------*
>>>> * Jiwon Jamie Ryu**
>>>> *
>>>> **
>>>> **
>>>> * PhD Candidate*
>>>> Dept. Bioengineering
>>>> Seoul National University
>>>> TEL: +82 10 8868 3678
>>>> Office: +82 2 2072 3128
>>>> *-------------------------------------------------------*-------------
>>>>
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>>>>
>>>
>>>
>>
>>
>> --
>> *-----------------------------------------------------------------*
>> * Jiwon Jamie Ryu**
>> *
>> **
>> **
>> * PhD Candidate*
>> Dept. Bioengineering
>> Seoul National University
>> TEL: +82 10 8868 3678
>> Office: +82 2 2072 3128
>> *-------------------------------------------------------*-------------
>>
>>
>
--
*-----------------------------------------------------------------*
* Jiwon Jamie Ryu**
*
**
**
* PhD Candidate*
Dept. Bioengineering
Seoul National University
TEL: +82 10 8868 3678
Office: +82 2 2072 3128
*-------------------------------------------------------*-------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20110804/454296bd/attachment.html>
-------------- next part --------------
igstk::PolarisTracker::Pointer tracker;
tracker = igstk::PolarisTracker::New();
tracker->AddObserver( itk::AnyEvent(), my_command);
tracker->SetLogger( logger );
//======= Start Polaris CT191.rom Communication ==========
tracker->SetCommunication( serialComm );
tracker->RequestOpen();
typedef igstk::PolarisTrackerTool TrackerToolType;
typedef TrackerToolType::TransformType TransformType;
std::string romFile = "CT191.rom";
TrackerToolType::Pointer trackerTool2 = TrackerToolType::New();
trackerTool2->SetLogger( logger );
trackerTool2->AddObserver( itk::AnyEvent(), my_command);
trackerTool2->RequestSelectWirelessTrackerTool();
trackerTool2->RequestSetSROMFileName( romFile );
trackerTool2->RequestConfigure();
trackerTool2->RequestAttachToTracker( tracker );
ObserverType::Pointer coordSystemAObserver2 = ObserverType::New();
coordSystemAObserver2->ObserveTransformEventsFrom( trackerTool2 );
//======= Start Polaris CT191.rom Tracking ==========
tracker->RequestStartTracking();
typedef igstk::Transform TransformType;
typedef ::itk::Vector<double, 3> VectorType;
typedef ::itk::Versor<double> VersorType;
CString str;
for(unsigned int i=0; i<10; i++)
{
igstk::PulseGenerator::CheckTimeouts();
//tracker->RequestUpdateStatus();
TransformType transform;
VectorType position;
VersorType rotation;
coordSystemAObserver2->Clear();
trackerTool2->RequestGetTransformToParent();
//trackerTool2->RequestComputeTransformTo( referenceTool );
// trackerTool2->ObserveTransformEventsFrom( trackerTool2 );
if (coordSystemAObserver2->GotTransform())
{
transform = coordSystemAObserver2->GetTransform();
if ( transform.IsValidNow() )
{ position = transform.GetTranslation();
rotation = transform.GetRotation();
str = (trackerTool2->GetTrackerToolIdentifier()).c_str();
GetDlgItem(IDC_CAMPOSNAME2)->SetWindowTextA(str);
/*
position[0] = 10.0;
position[1] = 0.0;
position[2] =0.0;
transform.SetTranslation(position,1, 200.0); */
str.Format("%10.3f",position[0]);
GetDlgItem(IDC_CamHeadPos1)->SetWindowTextA(str);
str.Format("%10.3f",position[1]);
GetDlgItem(IDC_CamHeadPos2)->SetWindowTextA(str);
str.Format("%10.3f",position[2]);
GetDlgItem(IDC_CamHeadPos3)->SetWindowTextA(str);
str.Format("%10.3f",rotation);
GetDlgItem(IDC_CamHeadPos4)->SetWindowTextA(str);
/* str.Format("%10.3f",rotation[1]);
GetDlgItem(IDC_CamHeadPos5)->SetWindowTextA(str);
str.Format("%10.3f",rotation[2]);
GetDlgItem(IDC_CamHeadPos6)->SetWindowTextA(str);
*/ // trackerTool2->GetUpdated();
}
}
}
//EndCodeSnippet
More information about the IGSTK-Users
mailing list