PlusToolkit / PlusLib

Software library for data acquisition, pre-processing, and calibration for navigated image-guided interventions.
http://www.plustoolkit.org
Other
135 stars 103 forks source link

Polaris Vega Device - CRC Error upon Averaging Feature Activation on the Device #1110

Closed psacris closed 11 months ago

psacris commented 1 year ago

Description

I'm facing a CRC error with the PlusServer when I activate the averaging feature directly on the Polaris Vega device. The server operates without any issues when the averaging is deactivated. I wanted to know if that is the expected behaviour, if I am missing something in the configuration, or if it could be a bug. To clarify, I do not want to do the averaging with the server. I just want the server to keep running when I activate averaging on the device.

Actual Behavior

Upon activating the averaging feature on the device by changing the Depth parameter to 8 at the Data Averaging configuration of the NDI Configure app, a CRC error appears repeatedly with the message:

"|WARNING|007.002000|SERVER> Bad CRC on reply from Measurement System| in E:\D\PTNP64b\PlusLib\src\PlusDataCollection\NDICAPITracking\vtkPlusNDITracker.cxx(495)"

Server Configuration

The head of my configuration xml looks like:

<?xml version="1.0"?>
<PlusConfiguration version="2.1">
    <DataCollection StartupDelaySec="1.0">
        <DeviceSet 
            Name="TestConfiguration" 
            Description="Test configuration file." />
        <Device 
            Id="Polaris Vega" 
            Type="NDITracker" 
            AcquisitionRate="400" 
            NetworkHostname="172.31.2.105" 
            BaudRate="1228739" 
            ToolReferenceFrame="Tracker">

I have tried to modify the configuration with the following options separately and combined but I have not been able to avoid the error

  AveragedItemsForFiltering="8"
  AveragingDepth="8"
  SmoothingFactor="0.5"

Plus Server Versions

I have tried with the latest stable release (PlusApp-2.8.0.20191105-Win64.exe) and the latest development snapshot (PlusApp-2.9.0.20230725-Win64.exe) with the same result described above.

Additional Information

adamrankin commented 1 year ago

I think it is both an expected feature, and a bug, as we have not experimented with any hardware averaging from the Vega. Any configuration variables will be strictly related to the software averaging feature of Plus.

I will explore the hardware averaging of the Vega and see what I can do.

psacris commented 1 year ago

Hi Adam, Thanks for the reply. I suppose that when activating the average feature on the device, the message is modified and that is why it gives the error. Let me know if I can help with the development in some way, although I am not familiar with either the library or the tracker messages.

adamrankin commented 1 year ago

To confirm, this is with a Vega XT? I'll go see if we have one, the one I am working with is a Vega

adamrankin commented 1 year ago

We do not have an XT. We do have an ST and VT, is this feature available on either of those?

adamrankin commented 1 year ago

I have followed your steps, but I don't get an error. However, I noticed that when I go back to NDI Configure after connecting to the device, Data Averaging Depth has been reset to 1

adamrankin commented 1 year ago

I have found this in the NDI documentation:

API Revision G.003.006 introduced the concept of data averaging.
Data averaging is available only in combination with the command BX2. If data averaging is enabled
and the command BX or TX is issued, the command returns an error code.

We do not currently support BX2, but I'll work on it

psacris commented 1 year ago

I am using a Polaris Vega XT with the Firmware Revision 010 (Package 010.017). I have found this in the documentation regarding different devices:

Data averaging is available for all Vega and Lyra systems, but is most useful on Vega XT
because of the higher frame rate achievable.
adamrankin commented 1 year ago

I have support for enabling data averaging and BX2 support, but when I turn on data averaging I get majority timeout responses from BX2 command (which doesn't happen without). Investigating

adamrankin commented 11 months ago

Timeout on BX2 averaging is by design, so I am trying to implement a feature to change timeout based on data averaging enabled or no. However, requesting the param "Param.Tracking.Track Frequency" always seems to return 0 instead of the actual value reported in the Configure app.

adamrankin commented 11 months ago

See https://github.com/PlusToolkit/PlusLib/pull/1126

adamrankin commented 11 months ago

Timeout on BX2 averaging is by design, so I am trying to implement a feature to change timeout based on data averaging enabled or no. However, requesting the param "Param.Tracking.Track Frequency" always seems to return 0 instead of the actual value reported in the Configure app.

It was returning an enum value, 0 1 or 2 for vega, 0 1 for lyra

adamrankin commented 11 months ago

Give the new master a go and let me know if it works for you

psacris commented 11 months ago

Hi Adam, I have managed to build the new version successfully. The CRC error doesn't occur anymore. However, in a preliminary test, I'm not sure if the poses generated by the server are smoothed. I have visualized the transformation in Slicer by toggling the smoothing on and off in the device, and I don't perceive any difference. Apart from the parameter in the device configuration, do I need to change the PlusServer configuration through the XML file?

adamrankin commented 11 months ago

All you should have to change is the HardwareDataAveragingDepth value (I tried 8 with Vega 1st gen)

psacris commented 11 months ago

Great! Now I'm able to obtain the averaged poses.

I have one last question regarding the configuration. I saw on (https://github.com/PlusToolkit/PlusLib/pull/1126) that a timeout must be updated accordingly. Is this adjustment handled automatically by the application, or do I need to make further configurations myself? Apart from the HardwareDataAveragingDepth value, is there anything else I should configure?"

adamrankin commented 11 months ago

The timeout is adjusted automatically. It still works with an unadjusted timeout, it just spams the log with warnings

psacris commented 11 months ago

Great! As far as I can test it works correctly. Thanks for the help!

ningw-git commented 1 month ago

Hello, I have the same problem. Have you solved your previous problem? Why did I still fail after using this minimalist configuration? I am so sad.