[IGSTK-Users] EM tracking giving the same readings
Patrick Cheng
patrick.p.cheng at gmail.com
Mon Jul 25 11:02:31 EDT 2011
Hi Ameet,
The code spinet you provided is probably not complete. The while loop
doesn't seem to be correct.
Try use this workflow:
loop{
observer->Clear();
trackerTool->RequestGetTransformToParent();
if (observer->GotTransform())
{
...
}
else
{
...
}
}
Let me know how it goes,
Patrick
On Fri, Jul 22, 2011 at 3:52 PM, Jain, Ameet <ameet.jain at philips.com> wrote:
> Hi all,****
>
> ** **
>
> I am having an issue in trying to use IGSTK for EM tracking a large tool
> with multiple 5DOFs. It starts to track the sensors alright, but then after
> some point it starts giving me the same tracked information for all sensors
> - i.e. it repeats the previous value continuously for hours. My feeling is
> that it gets a ‘bad fit’ at some point and then the sensor location does not
> get updated after that. ****
>
> ** **
>
> The code where I update the tracking info for each tool is below. Do you
> think this is not the correct way to implement the update?****
>
> ** **
>
> auroraTrackerTool[i]->RequestGetTransformToParent();****
>
> while(!TransformObserver[i]->GotTransform());****
>
> igstk::Transform transform = TransformObserver[i]->GetTransform();****
>
> igstk::Transform::VectorType t = transform.GetTranslation();****
>
> igstk::Transform::VersorType r = transform.GetRotation();****
>
> ** **
>
> Your help is much appreciated,****
>
> Thanks a lot in advance,****
>
> Ameet Jain****
>
> ** **
>
> ** **
>
> *PS: The code for initialization of the Aurora is below, in case you see
> some error there*
>
> igstk::SerialCommunication::PortNumberType AURORAPORT =
> (igstk::SerialCommunication::PortNumberType)6; ****
>
> igstk::SerialCommunication::Pointer serialCommAurora;****
>
> igstk::AuroraTracker::Pointer tracker;****
>
> igstk::AuroraTrackerTool::Pointer auroraTrackerTool[16];****
>
> igstk::TransformObserver::Pointer TransformObserver[16]; ****
>
> ** **
>
> void openauroraport()****
>
> {****
>
> serialCommAurora =
> igstk::SerialCommunication::New(); ****
>
> serialCommAurora->SetPortNumber( AURORAPORT );****
>
> serialCommAurora->SetParity(
> igstk::SerialCommunication::NoParity );****
>
> serialCommAurora->SetBaudRate(
> igstk::SerialCommunication::BaudRate115200 );****
>
> serialCommAurora->SetDataBits(
> igstk::SerialCommunication::DataBits8 );****
>
> serialCommAurora->SetStopBits(
> igstk::SerialCommunication::StopBits1 );****
>
> serialCommAurora->SetHardwareHandshake(
> igstk::SerialCommunication::HandshakeOff );****
>
> serialCommAurora->OpenCommunication();****
>
> ** **
>
> tracker = igstk::AuroraTracker::New();****
>
> std::cout << "SetCommunication()" << std::endl;****
>
> tracker->SetCommunication( serialCommAurora );****
>
> ** **
>
> std::cout << "RequestOpen()" << std::endl;****
>
> tracker->RequestOpen();****
>
> ** **
>
> for (int count_port = 0; count_port < 4; count_port++){***
> *
>
> auroraTrackerTool[2*count_port] =
> igstk::AuroraTrackerTool::New();****
>
>
> auroraTrackerTool[2*count_port]->RequestSelect5DOFTrackerTool();****
>
>
> auroraTrackerTool[2*count_port]->RequestSetPortNumber( count_port );****
>
>
> auroraTrackerTool[2*count_port]->RequestSetChannelNumber( 0 );****
>
>
> auroraTrackerTool[2*count_port]->RequestConfigure();****
>
>
> auroraTrackerTool[2*count_port]->RequestAttachToTracker( tracker );****
>
> ** **
>
> auroraTrackerTool[2*count_port + 1] =
> igstk::AuroraTrackerTool::New();****
>
> auroraTrackerTool[2*count_port +
> 1]->RequestSelect5DOFTrackerTool();****
>
> auroraTrackerTool[2*count_port +
> 1]->RequestSetPortNumber( count_port );****
>
> auroraTrackerTool[2*count_port +
> 1]->RequestSetChannelNumber( 1 );****
>
> auroraTrackerTool[2*count_port +
> 1]->RequestConfigure();****
>
> auroraTrackerTool[2*count_port +
> 1]->RequestAttachToTracker( tracker );****
>
> ** **
>
> std::cout << "Initialized Port" <<
> count_port << std::endl;****
>
> }****
>
> ** **
>
> ** **
>
> ****
>
> for (int count_port = 0; count_port < 4; count_port++){***
> *
>
> TransformObserver[2*count_port] =
> igstk::TransformObserver::New();****
>
>
> TransformObserver[2*count_port]->ObserveTransformEventsFrom(auroraTrackerTool[2*count_port]);
> ****
>
> ****
>
> TransformObserver[2*count_port + 1] =
> igstk::TransformObserver::New();****
>
> TransformObserver[2*count_port +
> 1]->ObserveTransformEventsFrom(auroraTrackerTool[2*count_port + 1]);****
>
> ** **
>
> std::cout << "Assigned Observer" <<
> count_port << std::endl;****
>
> }****
>
> ** **
>
> tracker->RequestStartTracking();****
>
> std::cout << "Requested Tracking" << std::endl;****
>
> ** **
>
> }****
>
> ------------------------------
> The information contained in this message may be confidential and legally
> protected under applicable law. The message is intended solely for the
> addressee(s). If you are not the intended recipient, you are hereby notified
> that any use, forwarding, dissemination, or reproduction of this message is
> strictly prohibited and may be unlawful. If you are not the intended
> recipient, please contact the sender by return e-mail and destroy all copies
> of the original message.
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20110725/7b309d60/attachment.html>
More information about the IGSTK-Users
mailing list