Page 1 of 1

Not able to compile C# examples

Posted: Mon May 08, 2023 11:12 am
by Rainer@Phidget
I can't get any Phidget C# example to run in Visual Studio 2017.
After opening the .sln file a lot of errors occur. (see screenshot)
Missing DLL, wrong Namespace etc.

I'm especially interested in
"Phidget22_SpatialAHRS_CSharp_Windows_Ex_20230331".

After unzipping I found 2 folders (SpatialAHRS + Common)
The folder Common contains multiple uncompiled projects (*.sln).
Some of them will be used in SpatialAHRS (DataGraphBox)
But I don't know how to combine the projects.

Trying to compile DataGraphBox I get the error:
"DataGraphBox is a Namespace but is used as aType"

It's so frustrating, I only want to know how to get 3 values out of the sensor, but I have to read and understand foreign undocumented code with 90% GUI and error handling !

Image

Re: Not able to compile C# examples

Posted: Tue May 09, 2023 9:45 am
by Patrick
Hi,

I would recommend using the code sample generator on the product page to generate much simpler readable code.

The example you have is the full-featured control panel GUI, and it is more geared towards usability than readability. I did notice recently that the standalone AHRS GUI doesn't compile, so that's being fixed in the next release - apologies.

-Patrick

Re: Not able to compile C# examples

Posted: Wed May 10, 2023 2:36 am
by Rainer@Phidget
Hi Patrick, thank you for your quick reply.

I only need a compass bearing for a rover moving in hilly terrain.
As a result, the sensor is not always exactly horizontal.

As I understand the complicated matter now, this is only possible with the AHRS calculation.
The more simple example "Phidget_Spetial_CSharp_Windows_Ex" gives only the correct bearing with the sensor parallel to the ground.

1) Can you please provide an executable program from the AHRS example (EXE + DLL), so that I can test the sensor easily.

2) Was it wrong to buy the "Spitial 3/3/3 Basic 1042_0" for my purpose ?

3) Will the "MOTO110_0" instead output the compass bearing (Euler Angles ?) directly as a value without any additional calculation ?

Many thanks

Re: Not able to compile C# examples

Posted: Wed May 10, 2023 10:41 am
by Patrick
Hi,

1042 doesn't have on-board AHRS, so as you've seen, you need to calculate your orientation yourself - you can do this in a number of different ways. The SpatialAHRS example does include the ComplementaryAHRS.cs, which is similar to the algorithm embedded in our more advanced Spatials.

We have found that running the AHRS algorithm on the 1042 is this way doesn't produce great results. Make sure to run your 1042 through the compass calibration, and validate your data.

You may have been better served by MOT0110 ($100), or MOT1102+HUB0001 ($60), as these both expose computed heading via the spatial API.

I'll make sure that the example compiles and get a new release pushed out. It also needs some updates to run properly with 1042.

-Patrick