Exemple #1
0
        static void Main(string[] args)
        {
            try
            {
                //create a Serial Connection with the specified COM Port, default baud rate of 921600
                mscl.Connection connection = mscl.Connection.Serial(COM_PORT);

                //create an InertialNode with the connection
                mscl.InertialNode node = new mscl.InertialNode(connection);

                //endless loop of reading in data
                while (true)
                {
                    try
                    {
                        //This example uses the "getNextDataPacket()" command. This command gets the next InertialDataPacket in the buffer and throws an exception if no data exists.
                        //Alternatively, you may use the "getDataPackets()" command to get ALL the InertialDataPackets available in the buffer. If the returned container is empty, no data exists.

                        //get the next data packet from the node, with a timeout of 500 milliseconds
                        mscl.InertialDataPacket packet = node.getNextDataPacket(500);

                        //print out the data
                        Console.Write("Packet Received: ");

                        //iterate over all the data points in the packet
                        foreach (mscl.InertialDataPoint dataPoint in packet.data())
                        {
                            //print out the channel data
                            Console.Write(dataPoint.ToString() + ": ");
                            Console.Write(dataPoint.as_string() + " "); //Just printing this out as a string. Other methods (ie. as_float, as_uint16, as_Vector) are also available.

                            //if the dataPoint is invalid
                            if (!dataPoint.valid())
                            {
                                //print out that it is invalid
                                Console.Write("[Invalid] ");
                            }
                        }
                        Console.WriteLine();
                    }
                    catch (mscl.Error_NoData noData)
                    {
                        Console.WriteLine(noData.Message);
                    }
                }
            }
            catch (mscl.Error e)
            {
                Console.WriteLine("Error: " + e.Message);
            }

            Console.WriteLine("Press Enter to quit...");
            Console.Read();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                //create a Serial Connection with the specified COM Port, default baud rate of 921600
                mscl.Connection connection = mscl.Connection.Serial(COM_PORT);

                //create an InertialNode with the connection
                mscl.InertialNode node = new mscl.InertialNode(connection);

                //endless loop of reading in data
                while (true)
                {
                    //get all of the next data packet from the node, with a timeout of 500 milliseconds
                    mscl.InertialDataPackets packets = node.getDataPackets(500);

                    foreach (mscl.InertialDataPacket in packets)
                    {
                        //print out the data
                        Console.Write("Packet Received: ");

                        //iterate over all the data points in the packet
                        foreach (mscl.InertialDataPoint dataPoint in packet.data())
                        {
                            //print out the channel data
                            Console.Write(dataPoint.ToString() + ": ");
                            Console.Write(dataPoint.as_string() + " "); //Just printing this out as a string. Other methods (ie. as_float, as_uint16, as_Vector) are also available.

                            //if the dataPoint is invalid
                            if (!dataPoint.valid())
                            {
                                //print out that it is invalid
                                Console.Write("[Invalid] ");
                            }
                        }
                        Console.WriteLine();
                    }
                }
            }
            catch (mscl.Error e)
            {
                Console.WriteLine("Error: " + e.Message);
            }

            Console.WriteLine("Press Enter to quit...");
            Console.Read();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            try
            {
                //create a Serial Connection with the specified COM Port, default baud rate of 921600
                mscl.Connection connection = mscl.Connection.Serial(COM_PORT);

                //create an InertialNode with the connection
                mscl.InertialNode node = new mscl.InertialNode(connection);

                //endless loop of reading in data
                while (true)
                {
                    //get all of the next data packet from the node, with a timeout of 500 milliseconds
                    mscl.InertialDataPackets packets = node.getDataPackets(500);

                    foreach (mscl.InertialDataPacket in packets)
                    {
                        //print out the data
                        Console.Write("Packet Received: ");

                        //iterate over all the data points in the packet
                        foreach (mscl.InertialDataPoint dataPoint in packet.data())
                        {
                            //print out the channel data
                            Console.Write(dataPoint.ToString() + ": ");
                            Console.Write(dataPoint.as_string() + " "); //Just printing this out as a string. Other methods (ie. as_float, as_uint16, as_Vector) are also available.

                            //if the dataPoint is invalid
                            if (!dataPoint.valid())
                            {
                                //print out that it is invalid
                                Console.Write("[Invalid] ");
                            }
                        }
                        Console.WriteLine();
                    }
                }
            }
            catch (mscl.Error e)
            {
                Console.WriteLine("Error: " + e.Message);
            }

            Console.WriteLine("Press Enter to quit...");
            Console.Read();
        }
Exemple #4
0
        public static void setCurrentConfig(mscl.InertialNode node)
        {
            //many other settings are available than shown below
            //reference the documentation for the full list of commands

            //if the node supports AHRS/IMU
            if (node.features().supportsCategory(mscl.MipTypes.DataClass.CLASS_AHRS_IMU))
            {
                mscl.MipChannels ahrsImuChs = new mscl.MipChannels();
                ahrsImuChs.Add(new mscl.MipChannel(mscl.MipTypes.ChannelField.CH_FIELD_SENSOR_SCALED_ACCEL_VEC, mscl.SampleRate.Hertz(500)));
                ahrsImuChs.Add(new mscl.MipChannel(mscl.MipTypes.ChannelField.CH_FIELD_SENSOR_SCALED_GYRO_VEC, mscl.SampleRate.Hertz(100)));

                //apply to the node
                node.setActiveChannelFields(mscl.MipTypes.DataClass.CLASS_AHRS_IMU, ahrsImuChs);
            }

            //if the node supports Estimation Filter
            if (node.features().supportsCategory(mscl.MipTypes.DataClass.CLASS_ESTFILTER))
            {
                mscl.MipChannels estFilterChs = new mscl.MipChannels();
                estFilterChs.Add(new mscl.MipChannel(mscl.MipTypes.ChannelField.CH_FIELD_ESTFILTER_ESTIMATED_GYRO_BIAS, mscl.SampleRate.Hertz(100)));

                //apply to the node
                node.setActiveChannelFields(mscl.MipTypes.DataClass.CLASS_ESTFILTER, estFilterChs);
            }

            //if the node supports GNSS
            if (node.features().supportsCategory(mscl.MipTypes.DataClass.CLASS_GNSS))
            {
                mscl.MipChannels gnssChs = new mscl.MipChannels();
                gnssChs.Add(new mscl.MipChannel(mscl.MipTypes.ChannelField.CH_FIELD_GNSS_LLH_POSITION, mscl.SampleRate.Hertz(1)));

                //apply to the node
                node.setActiveChannelFields(mscl.MipTypes.DataClass.CLASS_GNSS, gnssChs);
            }

            node.setPitchRollAid(true);

            node.setAltitudeAid(false);

            mscl.PositionOffset offset = new mscl.PositionOffset(0.0f, 0.0f, 0.0f);
            node.setAntennaOffset(offset);
        }
Exemple #5
0
        static void Main(string[] args)
        {
            try
            {
                //create a Serial Connection with the specified COM Port, default baud rate of 921600
                mscl.Connection connection = mscl.Connection.Serial(COM_PORT);

                //create an InertialNode with the connection
                mscl.InertialNode node = new mscl.InertialNode(connection);

                Console.WriteLine("Node Information: ");
                Console.WriteLine("Model Name: " + node.modelName());
                Console.WriteLine("Model Number: " + node.modelNumber());
                Console.WriteLine("Serial: " + node.serialNumber());
                Console.WriteLine("Firmware: " + node.firmwareVersion().ToString());
                Console.WriteLine();

                //TODO: Uncomment the lines below to run the examples

                //Example: Get Configuration
                //Example1.getCurrentConfig(node);

                //Example: Set Configuration
                //Example2.setCurrentConfig(node); //Warning: this example changes settings on your Node!

                //Example: Start Sampling
                //Example3.startSampling(node);

                //Example: Set to Idle
                //Example4.setToIdle(node);

                //Example: Parse Data
                //Example5.parseData(node);
            }
            catch (mscl.Error e)
            {
                Console.WriteLine("Error: " + e.Message);
            }

            Console.WriteLine("Press Enter to quit...");
            Console.Read();
        }
        public static void startSampling(mscl.InertialNode node)
        {
            //each class/category is separated into its own command.
            //you can enable them individually if, say, you only wanted the Estimation Filter channels to be streamed

            if (node.features().supportsCategory(mscl.MipTypes.DataClass.CLASS_AHRS_IMU))
            {
                node.enableDataStream(mscl.MipTypes.DataClass.CLASS_AHRS_IMU);
            }

            if (node.features().supportsCategory(mscl.MipTypes.DataClass.CLASS_ESTFILTER))
            {
                node.enableDataStream(mscl.MipTypes.DataClass.CLASS_ESTFILTER);
            }

            if (node.features().supportsCategory(mscl.MipTypes.DataClass.CLASS_GNSS))
            {
                node.enableDataStream(mscl.MipTypes.DataClass.CLASS_GNSS);
            }
        }