GithubHelp home page GithubHelp logo

lord-microstrain / mscl Goto Github PK

View Code? Open in Web Editor NEW
77.0 18.0 57.0 64.67 MB

MicroStrain Communication Library

Home Page: https://www.microstrain.com/software/mscl

License: MIT License

C++ 94.87% C 0.29% Python 0.42% C# 0.61% Batchfile 0.01% CSS 0.66% MATLAB 0.06% SWIG 1.99% Shell 0.12% PowerShell 0.14% CMake 0.82%
cplusplus csharp python dotnet labview sensors inertial-sensors navigation mscl microstrain

mscl's Introduction

MSCL - The MicroStrain Communication Library

MSCL is developed by MicroStrain in Williston, VT. It was created to make it simple to interact with our Wireless, Inertial, and digital Displacement sensors.

Latest

Downloads

Offline Documentation | Offline Example Code

Pre-built MSCL Binaries/Packages

Windows: C++ | Python 2.7 | Python 3.6 | Python 3.11 | .NET

Debian:

RPM:


If the pre-built packages aren't available on your platform, you can build MSCL from source.

Instructions can be found here: Building MSCL on Windows | Building MSCL on Linux


Documentation

How to use MSCL

Quick Start Guide

Public Documentation - Documentation for all the public functionality of MSCL.

Full Documentation - Full Documentation of everything in MSCL (useful when editing the source).

Example Code

FAQs

Included Libraries

OpenSSL - This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (https://www.openssl.org/) - see the License_OpenSSL.txt file in the source distribution.

Boost - see the License_Boost.txt file in the source distribution.

License

MSCL is released under the MIT License - see the LICENSE file in the source distribution.

Copyright (C) 2015-2024 MicroStrain by HBK. All Rights Reserved.

mscl's People

Contributors

crosvera avatar dacuster avatar kdllord avatar leolchat avatar msclissa avatar robbiefish avatar rwslord avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mscl's Issues

Error when starting Synchronized Sampling

I had to run my SynchronizedSampling.py script several times before the network started. Here is the output from one of the failures:

Adding node 49607 to the network...
Done.
Adding node 49608 to the network...
Done.
Adding node 52431 to the network...
Done.
Adding node 52432 to the network...
Done.
Adding node 52433 to the network...
Done.
Adding node 52435 to the network...
Done.
Adding node 52437 to the network...
Done.
Adding node 52377 to the network...
Done.
Adding node 52378 to the network...
Done.
Adding node 52379 to the network...
<type 'exceptions.Exception'> Failed to read EEPROM 108 from Node 52379
Done.
Adding node 52380 to the network...
Done.
Adding node 52381 to the network...
Done.
Adding node 52384 to the network...
<type 'exceptions.Exception'> Failed to read EEPROM 108 from Node 52384
Done.
Adding node 52386 to the network...
Done.
Adding node 52389 to the network...
Done.
Adding node 52390 to the network...
Done.
Adding node 52391 to the network...
Done.
Adding node 52392 to the network...
Done.
Adding node 52393 to the network...
Done.
Adding node 52394 to the network...
Done.
Adding node 52395 to the network...
Done.
Adding node 52397 to the network...
Done.
Adding node 52398 to the network...
Done.
Adding node 52399 to the network...
Done.
Adding node 52400 to the network...
Done.
Adding node 52401 to the network...
Done.
Adding node 52402 to the network...
<type 'exceptions.Exception'> Failed to read EEPROM 108 from Node 52402
Done.
Adding node 52404 to the network...
Done.
Adding node 52405 to the network...
Done.
Adding node 52406 to the network...
Done.
Adding node 52408 to the network...
Done.
Adding node 47675 to the network...
Done.
Network info:
Network OK: True
Percent of Bandwidth: 25.0244312286
Lossless Enabled: False
High Capacity Mode: False
Applying network configuration to network...
<type 'exceptions.Exception'> Failed to write EEPROM 250 to Node 52402
Error: Unable to create BaseStation global name 'sys' is not defined

SynchronizedSampling.zip

Thoughts?

Douglas

undefined symbol: _ZN4mscl10Connection9WebSocketERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEt

Hey @rwslord,

I was compiling the last version of mscl with the following parameters:

bjam MSCL//stage_c++ release --without-ssl --without-websockets -j 2
bjam MSCL//stage_python_x86 release --without-ssl --without-websockets

And everything is ok, but when I try to import the python module I got the following:

ImportError: /home/dm_status/DM/mscl/_mscl.so: undefined symbol: _ZN4mscl10Connection9WebSocketERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEt

Any idea about what could be happening?

Best regards.

How to get orientation of the Microstrain

Hello,

I have an 3DM-GX4-25 IMU that is outputting the following for it's measurements.

accelx= 0.000909228
accely= -0.000786797
accelz= -0.999432
rotx= 0.000375827
roty= -0.000894705
rotz= -0.000896965

I would like to calculate the roll pitch and yaw and after that the orientation matrix of the body frame relative to the NED frame.

so I do

roll = atan2(-accely,-accelz);
pitch =atan2(-accel_x/sqrt(pow(accely,2)+pow(accelz,2)));
sinyaw = -rotycos(roll)+rotzsin(roll);
cosyaw = rotxcos(pitch)+rotysin(roll)sin(pitch)+rotzcos(roll)*sin(pitch);
yaw = atan2(sinyaw,cosyaw);

and I get:

roll = 0.000787244
pitch = -0.000909744
yaw = 1.17206

in radians

However from mscl::InertialTypes::CH_FIELD_SENSOR_EULER_ANGLES

I get:

roll: -0.00261682
pitch: -0.00310018
yaw: 2.45783

Am I doing the alignment correctly?
Why am I getting different orientations from the two methods?
How is CH_FIELD_SENSOR_EULER_ANGLES calculated?

Online data reading from wireless sensors

Currently we are using Lord wireless sensors for acceleration recording. In my study, I need to access the acceleration data in real time. I contacted the Indian customer support and they advise to go through MSCL package.

So, I am using python program to access the data. My have trouble to retrieve the data. The sample code given in 'ParseData.py' is running an infinite loop and inside that loop I am unable to access 'sweep.data()'.

Unable to set Linear Equation

I want to set a user input Linear Equation as the sensors need to be calibrated before using them via V-Link 200. (I am trying to calibrate the sensors using mscl library)

I am using :
void linearEquation( const ChannelMask &mask,const LinearEquation &linearEquation ) as :

mscl.WirelessNodeConfig.linearEquation(group.channels(), mscl.LinearEquation(slope, offset))

to set the linear equation, however, it is not getting set. Also, how to set the unit?
PS: Slope and offset are user input

trouble getting datapoint timestamp

Hello,

I am trying to get the timestamp of a data point but it is throwing an exception. I declared t_meas as a Timestamp object but I get the Error_BadDataType exception.
const mscl::Timestamp t_meas = dataPoint.as_Timestamp();

Am I missing something?

Incorrect sampling frequency

Hello,

I am using a 3DM-GX4-25 to read both Euler angles and angular rates. I would like to do this at the highest possible frequency (which from the documentation on the adaptive Kalman Filter appears to be 500 Hz). Currently I am trying to sample at 500Hz and I have written a test piece of code to see if it is actually running at 500Hz. The two files shared below are imu.py and run_imu.py. The file imu.py is a class that communicates with the 3DM-GX4-25. The file run_imu.py uses that class to continuously read from the imu.

In the test code you will see that the IMU is set to sample at 500Hz but my code reads from the IMU at 400Hz. This would imply that every time I read from the IMU I should have a new piece of data if the IMU is actually sampling at 500Hz. I have written code to compare current data to previous data and I am finding that I am getting a substantial amount of repeated data. On average I get 3 repeated values in a row which implies the IMU is sampling at a frequency of 133Hz.

imu.py - https://gist.github.com/hooksj/0322ea03251ffd3567497d2f52e4b98c

run_imu.py - https://gist.github.com/hooksj/0791d6eae0975cc677db907f75ab0146

Please let me know if I have set something up incorrectly. My ideal setup is that each time I read from the IMU I get the latest estimation. It would be great if the buffer was only the size of 1 and never got filled up but I was unable to find a setting that would allow me to do that. Thank you in advance!

Error create a WirelessNode

Just started to work with MSCL. Running:

connection = mscl.Connection.Serial(COM_PORT)
baseStation = mscl.BaseStation(connection)
node = mscl.WirelessNode(NODE_ADDRESS, baseStation)

Setting the node, I only get the following:
Error: in method 'new_WirelessNode', argument 1 of type 'mscl::uint16'

Any advise would be grateful.

Thanks,
Johan

Unable to Get Data Sweeps

I'm using a wireless base station with a single node. I have the C# sample solution and I took the sample code for ParseData and copied it into the StartSampling routine. When I run it, I connect to the base station just fine, and everything looks good except every time it gets to the basestation.getdata(500) it times out without any sweeps. I have also tried starting it in sampling mode from Node Commander and then exiting Node Commander and trying the console app with no success. When I go into Node Commander, the node will go into sampling mode without issue. I also don't know if my code to do ChannelMask is correct. I don't see documentation for C#. I'm on a tight deadline, so would appreciate your help asap. Thanks and here is the sample code (I updated this version to be for the non-synchronized sampling as I only talk to one node, synchronized didn't work either) :

//MSCL Example: SynchronizedSampling
//   This example shows how to create and start a Synchronized Sampling network.
//
//Updated: 05/16/2017

//Note: If you are having 'PINVOKE' errors, please make sure the following is true:
//  -'MSCL_Managed' is added as a Refence for the project (add 'MSCL_Managed.dll')
//  -'MSCL.dll' is sitting next to the executable
//  -Your 'Platform Target' is set to x86

using System;

namespace SynchronizedSampling
{
    class Program
    {
        //TODO: change these constants to match your setup
        const String COM_PORT = "COM5";
        const int NODE_ADDRESS = 41656;

        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 a BaseStation with the connection
                mscl.BaseStation baseStation = new mscl.BaseStation(connection);

                //create a WirelessNode with the BaseStation we created
                mscl.WirelessNode node = new mscl.WirelessNode(NODE_ADDRESS, baseStation);

                //create a WirelessNodeConfig which is used to set all node configuration options
                mscl.WirelessNodeConfig config = new mscl.WirelessNodeConfig();

                //set some of the node's configuration options
                config.inactivityTimeout(7200);
                config.samplingMode(mscl.WirelessTypes.SamplingMode.samplingMode_nonSync);
                config.sampleRate(mscl.WirelessTypes.WirelessSampleRate.sampleRate_1Hz);
                config.unlimitedDuration(true);
                //mscl.ChannelMask activeChannels = new mscl.ChannelMask();
                //activeChannels.enable(0, true);
                //activeChannels.enable(1, true);
                //activeChannels.enable(2, true);
                //activeChannels.enable(3, false);

                //config.activeChannels(activeChannels);

                //apply the configuration to the Node
                node.applyConfig(config);

                node.startNonSyncSampling();

                while (true)
                {
                    //get all of the data sweeps that have been collected by the BaseStation, with a timeout of 500 milliseconds
                    mscl.DataSweeps sweeps = baseStation.getData(5000);

                    foreach (mscl.DataSweep sweep in sweeps)
                    {
                        //print out information about the sweep
                        Console.Write("Packet Received: ");
                        Console.Write("Node " + sweep.nodeAddress() + " ");
                        Console.Write("Timestamp: " + sweep.timestamp().ToString() + " ");
                        Console.Write("Tick: " + sweep.tick() + " ");
                        Console.Write("Sample Rate: " + sweep.sampleRate().prettyStr() + " ");
                        Console.Write("Base RSSI: " + sweep.baseRssi() + " ");
                        Console.Write("Node RSSI: " + sweep.nodeRssi() + " ");

                        //get the container of data in the sweep
                        mscl.ChannelData data = sweep.data();

                        Console.Write("DATA: ");
                        //iterate over each point in the sweep
                        foreach (mscl.WirelessDataPoint dataPoint in data)
                        {
                            //print out the channel name
                            Console.Write(dataPoint.channelName() + ": ");

                            //Print out the channel data as a string. Other methods (ie. as_float, as_uint16) are also available.
                            //Note: The storedAs() function describes how the data is actually stored
                            Console.Write(dataPoint.as_string() + " ");
                        }
                        Console.WriteLine();
                    }
                }
            }
            catch (mscl.Error e)
            {
                Console.WriteLine("Error: " + e.Message);
            }

            Console.WriteLine("Press Enter to quit...");
            Console.Read();
        }
    }
}

Problems with building the python stage

Hello @rwslord,

I've successful compiled the source code with bjam MSCL//stage_c++ release, but when I want to compile the Python module I got this error:

% bjam MSCL//stage_python release                                                                                                                                                            
...patience...
...found 839 targets...
...updating 4 targets...
swig.swig /home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp
/bin/sh: 2: Syntax error: "(" unexpected

    swig -c++ -DUNIX_SOCKETS -outdir /home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/swig-python -python -o /home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp MSCL/source/mscl/Wrapper/MSCL_Main_Interface.i

...failed swig.swig /home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp...
...skipped <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release>source/mscl/Wrapper/MSCL_Main_Interface.o for lack of <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release-object(c-scanner)@993>source/mscl/Wrapper/MSCL_Main_Interface.cpp...
...skipped <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release>_mscl.so for lack of <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release>source/mscl/Wrapper/MSCL_Main_Interface.o...
...skipped <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/Output/Python>_mscl.so for lack of <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release>_mscl.so...
...failed updating 1 target...
...skipped 3 targets...

Any idea why?

Regards

Compiling MSCL under Cygwin

I am trying to compile MSCL under 32-bit version of Cygwin. The following packages are installed:

  • p7zip
  • gcc-g++
  • python
  • rsync
  • git

The MSCL setup is as follows:

  1. Downloaded boost_1_61_0 source into /libraries/boost_1_61_0 and compiled it.
  2. Edited my .bashrc file and added the following lines:
    export BOOST_ROOT=/usr/local/build/boost/
    export BOOST_BUILD_PATH=/libraries/boost_1_61_0/
  3. Created a user-config.jam file with the following line:
    using gcc : 5.4.0 : /usr/bin/g++ : <cxxflags>-I/usr/include/python2.7 ;
  4. Cloned the MSCL repository onto my machine.
  5. From the top of the MSCL directory structure ran
    ./BuildScripts/buildAll.sh
    which returned the following:

========================================================
(buildAll.sh) STARTING MSCL BUILD
(buildAll.sh) Creating the build\swig-python directory
(buildAll.sh) Running BJAM (C++)
...patience...
...found 989 targets...
...updating 218 targets...
gcc.compile.c++ /cygdrive/d/Software/MSCL_source/MSCL/build/MSCL/gcc-5.4.0/release/source/stdafx.o
In file included from /usr/local/include/boost/asio/async_result.hpp:18:0,
from /usr/local/include/boost/asio.hpp:20,
from MSCL/source/stdafx.h:13,
from MSCL/source/stdafx.cpp:6:
/usr/local/include/boost/asio/detail/config.hpp:566:5: warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [-Wcpp]
# warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
^
/usr/local/include/boost/asio/detail/config.hpp:567:5: warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. [-Wcpp]
# warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
^
/usr/local/include/boost/asio/detail/config.hpp:568:5: warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). [-Wcpp]
# warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
^
/usr/local/include/boost/asio/detail/config.hpp:592:5: error: #error You must add -D__USE_W32_SOCKETS to your compiler options.
# error You must add -D__USE_W32_SOCKETS to your compiler options.
...

Is this a Boost compilation issue or a MSCL compilation issue?

Thanks,

Douglas

Error compiling under Debian Linux

I am trying the compile the MSCL libraries on a Debian Linux system. I am using the following versions of various programs:

gcc version 4.9.2 (Debian 4.9.2-10)
Boost.Jam Version 2011.12.1 OS=LINUX.

BJAM (C++) completes.
BJAM (Python) has errors.

Error file is attached.

Thanks,

Douglas
buildAll_output.txt

synchronized stopping armed Nodes

Hi,
I am trying to stop the logging after certain time, but when I set nodes to idle(in order to stop them) they don't stop at the same point. So I got different sizes of logged data from each node.

How can I force all nodes to stop the armed data logging at the same time?

Thanks

Get DataLogging data

Hello @rwslord,

I'm trying to test the DataLogging mode in some G-Link2 nodes using the MSCL framework, I can successfully create an ArmedDataloggingNetwork, add it some nodes and start sampling, but what I really didn't find is an ArmedDataloggingNetwork or WirelessNode object's method to collect the data stored. Maybe I missed something to read in the docs?

Best regards.

Making Sense of Acquired Data

Here's my code:

# SET ARMED DATALOGGING CONFIGURATION

config = mscl.WirelessNodeConfig()

# create an ArmedDataloggingNetwork object, giving it the BaseStation that will be the master BaseStation for the network
network = mscl.ArmedDataloggingNetwork(basestation)

# set the configuration options that we want to change
config.samplingMode(mscl.WirelessTypes.samplingMode_armedDatalog)
config.inactivityTimeout(7200)
config.sampleRate(mscl.WirelessTypes.sampleRate_1024Hz)
config.dataFormat(mscl.WirelessTypes.dataFormat_cal_float)
config.unlimitedDuration(False)
config.numSweeps(2100)
for node in nodes:
    chgroups = node.features().channelGroups()
    for group in chgroups:
        config.unit(group.channels(), mscl.WirelessTypes.unit_accel_g)
        print(node.getUnit(group.channels()))
    node.applyConfig(config)
    network.addNode(node)    

Output:

4
4
4
4

Therefore, the channels must be in units of G's.

# SEE DATA

for node in nodes:
    dwn = mscl.DatalogDownloader(node)
    print(dwn.calsApplied())
    na = node.nodeAddress()
    while not dwn.complete():
        sweep = dwn.getNextData()
        ts = sweep.timestamp()
        tick = sweep.tick()
        pnts = [p.as_float() for p in sweep.data()]
        print(tick, ts, pnts)

Output snippet:

True
0 2017-06-16 16:34:35.001298340 [1929.0, 1822.0, 1373.0]
1 2017-06-16 16:34:35.002274902 [1930.0, 1818.0, 1373.0]
2 2017-06-16 16:34:35.003251464 [1933.0, 1822.0, 1377.0]
3 2017-06-16 16:34:35.004228026 [1931.0, 1818.0, 1374.0]
4 2017-06-16 16:34:35.005204588 [1932.0, 1824.0, 1377.0]
5 2017-06-16 16:34:35.006181150 [1929.0, 1820.0, 1376.0]

Therefore, with calibration coefficients applied and units of Gs, the data points in each channel are on the order of magnitude of 1000 which doesn't make a whole lot of sense. The nodes are placed on a stationary table when I took this data, so there shouldn't be much acceleration at all. I tried collecting data using the Node Commander software and found results that were more reasonable. Is there some sort of post-processing on the data that I'm neglecting?

Autobalance in MSCL differs with NodeCommander

I have been testing the WirelessNode.autobalance() function, and I realised that I'm having different results comparing with NodeCommander autobalance.

Specifically, trying to autobalance at mid-scale a channel without nothing connected (no-sensor). In node commander I got this:
autobalance

As you can see, I'm getting a offset-scale of 65535 bits and the hardware offset is 177, also the percentage achieved is 9%.

Now, I made the same autobalance over the same channel via MSCL's WirelessNode().autobalance(), and I got this:

+ Percentage channel was balanced: 42.93
+ New offset-scale: 28134.0
+ Input Range (Gain): +- 2 mV
+ New hardware offset: 153

the errorCode that I get is 1 or 2. But as you can see what I got is very different from what NodeCommander returns. And now I have some question about it:

  1. How can the percentage vary from 9% to 42%, do you do some extra math?
  2. The offset scale I calculated by offset_scale = bits_resolution * percentageAchieved() / 100 is that ok? because I got 42% it looks like I have a good autobalance, despite the fact that I have no sensor connected.
  3. From NodeCommander window, I can see that the hardware Gain is setted at +- 2.5 mV, but MSCL WirelessType.InputRange enum says it is +- 2mV. Is it just a typo in the code?
  4. The hardware offset also differs, do you do some extra math?

Thanks
Best regards.

Error importing mscl.py

Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import mscl
Traceback (most recent call last):
File "", line 1, in
File "mscl.py", line 17, in
_mscl = swig_import_helper()
File "mscl.py", line 16, in swig_import_helper
return importlib.import_module('_mscl')
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
ImportError: libboost_chrono.so.1.64.0: cannot open shared object file: No such file or directory

I think my problem relates to this, from the Linux install guide:
"Note: The default Python build does not link in dependencies (such as Boost) directly. You will need to link the dependencies in when using mscl.py in your project."

I don't understand what, how, or where I'm supposed to link.

Boost No such file or directory

After following the instructions on this page, I got this error message when building MSCL.

MSCL/source/mscl/ScopeHelper.cpp:6:
MSCL/source/mscl/Communication/BoostCommunication.h:14:27: fatal error: boost/beast.hpp: No such file or directory

My installation steps:

tar --bzip2 -xf /path/to/boost_1_64_0.tar.bz2

Add user-config.jam to /home/username/boost_1_64_0

using gcc
:	host
:	g++
:	<cxxflags>-I/usr/include/python2.7
	<cxxflags>-I/home/username/boost/include
	<cxxflags>-I/usr/include/openssl
	<linkflags>-L/home/username/boost/lib
;
./bootstrap.sh --prefix=/home/username/boost
./b2 install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/username/boost/lib
bjam MSCL//stage_c++ release

building mscl.py

Problem building mscl.py, any suggestions?

$ bjam MSCL//stage_python_x86 release
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
...patience...
...found 1060 targets...
...updating 4 targets...
swig.swig /home/pi/Downloads/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp
MSCL/source/mscl/Wrapper/../Bin.h:28: Error: Syntax error in input(3).

	swig -c++ -DUNIX_BUILD -modern -outdir "/home/pi/Downloads/MSCL-master/build/swig-python" -python -o "/home/pi/Downloads/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp" "MSCL/source/mscl/Wrapper/MSCL_Main_Interface.i"

...failed swig.swig /home/pi/Downloads/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp...
...skipped <p/home/pi/Downloads/MSCL-master/build/MSCL/gcc-4.9.2/release>source/mscl/Wrapper/MSCL_Main_Interface.o for lack of <p/home/pi/Downloads/MSCL-master/build/MSCL/gcc-4.9.2/release-object(c-scanner)@1227>source/mscl/Wrapper/MSCL_Main_Interface.cpp...
...skipped <p/home/pi/Downloads/MSCL-master/build/MSCL/gcc-4.9.2/release>_mscl.so for lack of <p/home/pi/Downloads/MSCL-master/build/MSCL/gcc-4.9.2/release>source/mscl/Wrapper/MSCL_Main_Interface.o...
...skipped <p/home/pi/Downloads/MSCL-master/Output/Python/x86>_mscl.so for lack of <p/home/pi/Downloads/MSCL-master/build/MSCL/gcc-4.9.2/release>_mscl.so...
...failed updating 1 target...
...skipped 3 targets...

Visual Studio 2010 Throws IPINVOKE Error Only When Using VB

I get the typical IPINVOKE issue in Visual Studio 2010, when using Visual Basic. However, when I run the code in C# everything works fine. Unfortunately, VB is not documented in the help library so I had to translate some of the code into VB, which shouldn't be hard, but might be the source of the error.

Currently I'm just trying to translate the introduction examples into VB: http://lord-microstrain.github.io/MSCL/Documentation/Getting%20Started/index.html

Does anyone have a working example? That would at least exclude the possibility that this is the "typical" IPINVOKE error that was discussed here several times.

Below is the exception I got back from trying to call mscl.LibVersion.asString()

System.TypeInitializationException was unhandled
HResult=-2146233036
Message=The type initializer for 'mscl.msclPINVOKE' threw an exception.
Source=MSCL_Managed
TypeName=mscl.msclPINVOKE
StackTrace:
at mscl.msclPINVOKE.LibVersion_asString()
at mscl.LibVersion.asString()
at LORD_MicroStrain.Main.btnInit_Click(Object sender, EventArgs e) in
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at LORD_MicroStrain.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.TypeInitializationException
HResult=-2146233036
Message=The type initializer for 'SWIGExceptionHelper' threw an exception.
Source=MSCL_Managed
TypeName=SWIGExceptionHelper
StackTrace:
at mscl.msclPINVOKE.SWIGExceptionHelper..ctor()
at mscl.msclPINVOKE..cctor()
InnerException: System.BadImageFormatException
HResult=-2147024885
Message=An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Source=MSCL_Managed
StackTrace:
at mscl.msclPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_mscl(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at mscl.msclPINVOKE.SWIGExceptionHelper..cctor()
InnerException:

Error: InertialChannel (33286) is not in the Sensor descriptor set

Hello,

When i do:

chs.push_back(mscl::InertialChannel(mscl::InertialTypes::CH_FIELD_ESTFILTER_ESTIMATED_GYRO_BIAS, mscl::SampleRate::Hertz(1/intvl))); chs.push_back(mscl::InertialChannel(mscl::InertialTypes::CH_FIELD_ESTFILTER_ESTIMATED_ACCEL_BIAS, mscl::SampleRate::Hertz(1/intvl)));
I get Error: InertialChannel (33286) is not in the Sensor descriptor set
Is there a way to fix this?
Thanks.

python wrapper can't build in v35.1.2 under linux

see the build output from linux

bjam MSCL//stage_python_x86 release --without-ssl --without-websockets | grep error
MSCL/source/mscl/Wrapper/../Utils.h:521:16: error: 'function' in namespace 'std' does not name a template type
MSCL/source/mscl/Wrapper/../Utils.h:499:13: error: class 'mscl::Utils::Lazy<T>' does not have any field named 'm_loadFn'
MSCL/source/mscl/Wrapper/../Utils.h:504:13: error: class 'mscl::Utils::Lazy<T>' does not have any field named 'm_loadFn'
MSCL/source/mscl/Wrapper/../Utils.h:514:27: error: there are no arguments to 'm_loadFn' that depend on a template parameter, so a declaration of 'm_loadFn' must be available [-fpermissive]

$ git grep m_loadFn
MSCL/source/mscl/Utils.h:            m_loadFn(loadFn),
MSCL/source/mscl/Utils.h:            m_loadFn(nullptr),
MSCL/source/mscl/Utils.h:                m_value = m_loadFn();
MSCL/source/mscl/Utils.h:          std::function<T()> m_loadFn;

Does not connect to 3DM-Gx2

using python version with 3DM-GX2 over serial and any call via the InertialNode object returns Failed to communicate with device. i.e. call node.SetToIdel().

Using python example as a starting point.

The serial port works as i can read bytes from a gps.
The 3DM-Gx2 works on windows with microstrain software gui.

is this compatible with the 3DM-GX2 devices?

Using python 2.7.12
Ubuntu 16.04.1 LTS 64bit

Class SyncSamplingNetwork in labVIEW

Hi,

i'm trying to make a labVIEW Code for synchronized sampling the Nodes, but I don't find the class SyncSamplingNetwork in microstrain add on?

Visual Studio Pro 2015 Throws Error Unable to load DLL 'mscl'

Trying to run your C# example code VS 2015 throws the error at mscl.Connection connection = mscl.Connection.Serial(COM_PORT); Same error happened when I built my own project.

The dlls are loaded in to the dependencies directory and the object and methods show up on the VS Object Browser and look correct, as are the Solution References.

I've build many projects with my own and 3rd party libraries and haven't seen this problem before. Typically if the references are not set up correctly you can't browse them and the solution will say they're missing etc. Changing target framework didn't help. No other packages/dependencies added so there shouldn't be any conflicts with other libs.

I accidentally downloaded an earlier version of code but just tried it with 1.32.0.0 which I believe is the latest and it still threw the same error.

System.TypeInitializationException was unhandled
Message=The type initializer for 'mscl.msclPINVOKE' threw an exception.
Source=MSCL_Managed
TypeName=mscl.msclPINVOKE
StackTrace:
at mscl.msclPINVOKE.Connection_Serial__SWIG_1(String jarg1)
at mscl.Connection.Serial(String port)
at ParseData.Program.Main(String[] args) in C:\Users\tkreyche\Source\Repos\EVOX Microstrain Monitor\Examples\Wireless\CSharp\MSCL_Examples_CSharp\ParseData\ParseData.cs:line 27
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Message=The type initializer for 'SWIGExceptionHelper' threw an exception.
Source=MSCL_Managed
TypeName=SWIGExceptionHelper
StackTrace:
at mscl.msclPINVOKE.SWIGExceptionHelper..ctor()
at mscl.msclPINVOKE..cctor()
InnerException:
Message=Unable to load DLL 'mscl': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Source=MSCL_Managed
TypeName=""
StackTrace:
at mscl.msclPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_mscl(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at mscl.msclPINVOKE.SWIGExceptionHelper..cctor()
InnerException:

Getting error trying to build MSCL for python

Hello,

I'm trying to build the package under Ubuntu 14.04, I ran the "buildAll.sh" script but I get some errors related to the "target"

(buildAll.sh) STARTING MSCL BUILD
(buildAll.sh) Creating the build\swig-python directory
(buildAll.sh) Running BJAM (C++)
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
/usr/share/boost-build/build-system.jam:197: in find-target
warning: object is empty
/usr/share/boost-build/build-system.jam:661: in load
/usr/share/boost-build/kernel/modules.jam:289: in import
/usr/share/boost-build/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope
notice: could not find main target MSCL//stage_c++
notice: assuming it is a name of file to create.
error: Project target requested but not yet assigned for module 'Jamfile</home/crosvera/MSCL/BuildScripts>'.

(buildAll.sh) Running BJAM (Python)
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
/usr/share/boost-build/build-system.jam:197: in find-target
warning: object is empty
/usr/share/boost-build/build-system.jam:661: in load
/usr/share/boost-build/kernel/modules.jam:289: in import
/usr/share/boost-build/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope
notice: could not find main target MSCL//stage_python
notice: assuming it is a name of file to create.
error: Project target requested but not yet assigned for module 'Jamfile</home/crosvera/MSCL/BuildScripts>'.

(buildAll.sh) Running BJAM (Python) (2)
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
/usr/share/boost-build/build-system.jam:197: in find-target
warning: object is empty
/usr/share/boost-build/build-system.jam:661: in load
/usr/share/boost-build/kernel/modules.jam:289: in import
/usr/share/boost-build/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope
notice: could not find main target MSCL//stage_python
notice: assuming it is a name of file to create.
error: Project target requested but not yet assigned for module 'Jamfile</home/crosvera/MSCL/BuildScripts>'.

Do you have any idea?

Thanks in advance,
Regards

Getting errors while building MSCL Libraries

Hello,

I'm trying to build the package under Rasbian, I ran the "bash buildAll.sh" script but I get some errors and I don't know about them

pi@raspberrypi:~/MSCL-master $ sudo bash buildAll.sh

(buildAll.sh) STARTING MSCL BUILD
(buildAll.sh) Creating the build\swig-python directory
(buildAll.sh) Running BJAM (C++)
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
...patience...
...found 1021 targets...
(buildAll.sh) Running BJAM (Python)
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
...patience...
...found 1109 targets...
...updating 3 targets...
gcc.compile.c++ /home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.o
/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp:173:21: fatal error: Python.h: No such file or directory

include <Python.h>

                 ^

compilation terminated.

"g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -fPIC -std=c++11 -DNDEBUG -DUNIX_BUILD  -I"MSCL/source" -I"MSCL/source/mscl/Wrapper" -c -o "/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.o" "/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp"

...failed gcc.compile.c++ /home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.o...
...skipped <p/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release>_mscl.so for lack of <p/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release>source/mscl/Wrapper/MSCL_Main_Interface.o...
...skipped <p/home/pi/MSCL-master/Output/Python>_mscl.so for lack of <p/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release>_mscl.so...
...failed updating 1 target...
...skipped 2 targets...
(buildAll.sh) Running BJAM (Python) (2)
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
...patience...
...found 1109 targets...
...updating 3 targets...
gcc.compile.c++ /home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.o
/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp:173:21: fatal error: Python.h: No such file or directory

include <Python.h>

                 ^

compilation terminated.

"g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -fPIC -std=c++11 -DNDEBUG -DUNIX_BUILD  -I"MSCL/source" -I"MSCL/source/mscl/Wrapper" -c -o "/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.o" "/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.cpp"

...failed gcc.compile.c++ /home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release/source/mscl/Wrapper/MSCL_Main_Interface.o...
...skipped <p/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release>_mscl.so for lack of <p/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release>source/mscl/Wrapper/MSCL_Main_Interface.o...
...skipped <p/home/pi/MSCL-master/Output/Python>_mscl.so for lack of <p/home/pi/MSCL-master/build/MSCL/gcc-4.9.2/release>_mscl.so...
...failed updating 1 target...
...skipped 2 targets...

Can anyone guide me that how can I remove these errors. I have installed Swig and Boost latest versions on Rasbian but still I am failing to build MSCL libraries for Python.

Compiling problems with 3 targets

Hello @rwslord ,

I cloned the project and tried to compile it under Ubuntu 14.04 but bjam gave me the following problem:

% bjam MSCL//stage_c++ release
...patience...
...found 835 targets...
...updating 3 targets...
gcc.compile.c++ /home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release/source/mscl/Utils.o
MSCL/source/mscl/Utils.cpp: In function ‘void mscl::Utils::filterSensorcloudName(std::string&)’:
MSCL/source/mscl/Utils.cpp:406:68: error: no matching function for call to ‘regex_replace(std::string&, std::regex, const char [2])’
    str = std::regex_replace(str, std::regex("[^a-zA-Z0-9-_.]"), "-");
                                                                    ^   
MSCL/source/mscl/Utils.cpp:406:68: note: candidates are:
In file included from /usr/include/c++/4.8/regex:62:0,
                 from MSCL/source/stdafx.h:42,
                 from MSCL/source/mscl/Utils.cpp:14:
/usr/include/c++/4.8/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
     ^                                                                                                                                                                                       
/usr/include/c++/4.8/bits/regex.h:2162:5: note:   template argument deduction/substitution failed:
MSCL/source/mscl/Utils.cpp:406:68: note:   deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex<char>’ and ‘const char*’)
    str = std::regex_replace(str, std::regex("[^a-zA-Z0-9-_.]"), "-");
                                                                    ^   
In file included from /usr/include/c++/4.8/regex:62:0,
                 from MSCL/source/stdafx.h:42,
                 from MSCL/source/mscl/Utils.cpp:14:
/usr/include/c++/4.8/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<OutputT> std::regex_replace(const std::basic_string<OutputT>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<OutputT>&, std::regex_constants::match_flag_type)
     regex_replace(const basic_string<_Ch_type>& __s,
     ^   
/usr/include/c++/4.8/bits/regex.h:2182:5: note:   template argument deduction/substitution failed:
MSCL/source/mscl/Utils.cpp:406:68: note:   mismatched types ‘const std::basic_string<OutputT>’ and ‘const char [2]’
    str = std::regex_replace(str, std::regex("[^a-zA-Z0-9-_.]"), "-");
                                                                    ^   

    "g++"  -ftemplate-depth-128 -I/usr/include/python2.7 -O3 -finline-functions -Wno-inline -Wall -fPIC -std=c++11 -DNDEBUG -DUNIX_SOCKETS  -I"MSCL/source" -c -o "/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release/source/mscl/Utils.o" "MSCL/source/mscl/Utils.cpp"

...failed gcc.compile.c++ /home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release/source/mscl/Utils.o...
...skipped <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release>libmscl.so for lack of <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release>source/mscl/Utils.o...
...skipped <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/Output/C++/Release>libmscl.so for lack of <p/home/crosvera/Dropbox (Damage Monitor)/trabajo/MSCL/build/MSCL/gcc-host/release>libmscl.so...
...failed updating 1 target...
...skipped 2 targets...

Any idea?

Best regards

Separating triggers during armed datalogging

Hi! When downloading data, multiple triggers are being grouped in the output from the DatalogDownloader object. How can I separate out each trigger into individual sessions?

Here's my code:

# SET ARMED DATALOGGING CONFIGURATION

config = mscl.WirelessNodeConfig()
config.samplingMode(mscl.WirelessTypes.samplingMode_armedDatalog)
config.inactivityTimeout(7200)
config.sampleRate(mscl.WirelessTypes.sampleRate_1024Hz)
config.unlimitedDuration(False)
config.numSweeps(2100)

network = mscl.ArmedDataloggingNetwork(basestation)

for node in nodes:
    node.applyConfig(config)
    network.addNode(node)

# START DATALOGGING

network.startSampling()

# SET NODES TO IDLE

for node in nodes:
    status = node.setToIdle()
    while not status.complete(500):
        print('.')
    result = status.result()
    if result == mscl.SetToIdleStatus.setToIdleResult_success:
    # completed successfully
     print('Successfully idled Node', node.name())
    elif result == mscl.SetToIdleStatus.setToIdleResult_canceled:
    # canceled by the user
     print('Idle command canceled by user for Node', node.name())
    else:
    # Failed to perform the operation
     print('Failed to idle Node', node.name())

# DOWNLOAD DATA

for node in nodes:
    dwn = mscl.DatalogDownloader(node)
    name = node.name()
    while not dwn.complete():
        sweep = dwn.getNextData()
        timestamp = sweep.timestamp()
        data = [p.as_float() for p in sweep.data()]
        node_list[nodes.index(node)].append([name, timestamp, data[0], data[1], data[2]])

WirelessNode.channels() method doesn't exists

Hello @rwslord

In the Example file at MSCL_Examples/Wireless/Python/ConfigureNode.py, it does the following:

# get a list of the supported channels
supportedChannels = node.channels()

But when I tried it I got:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-30-1dd55c451f70> in <module>()
----> 1 node.channels()

/home/crios/venvs/us2dm/lib/python2.7/site-packages/mscl/mscl.pyc in <lambda>(self, name)
   1504     __setattr__ = lambda self, name, value: _swig_setattr(self, WirelessNode, name, value)
   1505     __swig_getmethods__ = {}
-> 1506     __getattr__ = lambda self, name: _swig_getattr(self, WirelessNode, name)
   1507     __repr__ = _swig_repr
   1508     def __init__(self, *args):

/home/crios/venvs/us2dm/lib/python2.7/site-packages/mscl/mscl.pyc in _swig_getattr(self, class_type, name)
     55     method = class_type.__swig_getmethods__.get(name,None)
     56     if method: return method(self)
---> 57     raise AttributeError(name)
     58 
     59 def _swig_repr(self):

AttributeError: channels

What I think is working is the following:

ac = node.getActiveChannels()
active_channels = []
for i in range(1, ac.MAX_CHANNELS+1):
    if ac.enabled(i): active_channels.append(i)

Best Regards

Could not find main target MSCL (compiling in Ubuntu)

hello @rwslord,

I was attempting to compile the new MSCL version, but I got some errors related with bjam targets:

crios@tigle:~/MSCL/BuildScripts$ bash buildAll.sh 
========================================================
(buildAll.sh) STARTING MSCL BUILD
(buildAll.sh) Creating the build\swig-python directory
(buildAll.sh) Running BJAM (C++)
/usr/share/boost-build/build-system.jam:197: in find-target
warning: object is empty
/usr/share/boost-build/build-system.jam:661: in load
/usr/share/boost-build/kernel/modules.jam:289: in import
/usr/share/boost-build/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope
notice: could not find main target MSCL//stage_c++
notice: assuming it is a name of file to create.
error: Project target requested but not yet assigned for module 'Jamfile</home/crios/MSCL/BuildScripts>'.

(buildAll.sh) Running BJAM (Python)
/usr/share/boost-build/build-system.jam:197: in find-target
warning: object is empty
/usr/share/boost-build/build-system.jam:661: in load
/usr/share/boost-build/kernel/modules.jam:289: in import
/usr/share/boost-build/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope
notice: could not find main target MSCL//stage_python
notice: assuming it is a name of file to create.
error: Project target requested but not yet assigned for module 'Jamfile</home/crios/MSCL/BuildScripts>'.

(buildAll.sh) Running BJAM (Python) (2)
/usr/share/boost-build/build-system.jam:197: in find-target
warning: object is empty
/usr/share/boost-build/build-system.jam:661: in load
/usr/share/boost-build/kernel/modules.jam:289: in import
/usr/share/boost-build/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope
notice: could not find main target MSCL//stage_python
notice: assuming it is a name of file to create.
error: Project target requested but not yet assigned for module 'Jamfile</home/crios/MSCL/BuildScripts>'.

(buildAll.sh) Building Unit Tests
notice: could not find main target MSCL_Unit_Tests
notice: assuming it is a name of file to create.
error: Project target requested but not yet assigned for module 'Jamfile</home/crios/MSCL/BuildScripts>'.

(buildAll.sh) Running Unit Tests
buildAll.sh: line 26: MSCL_Unit_Tests/unitTestResults.xml: No such file or directory
(buildAll.sh) Zipping the MSCL Output
bash: BuildScripts/zipOutput.sh: No such file or directory
(buildAll.sh) DONE

Any idea what happened with the installer?

Best regards

Invalid Configuration

Hello there,

I have a G-Link2 node and I want to start sampling in LowDutyCycle, but setting the configuration I got a "Invalid Configuration" Error, my code is the following:

import sys
import time

import mscl



def node_set_idle(node, tries=20):
    print "Attemting to set in Idle mode node"
    idleStatus = node.setToIdle()
    n = 0
    while not idleStatus.complete():
        sys.stdout.write(".")
        if n == 10:
            idleStatus.cancel()
        n += 1
        sys.stdout.flush()
        time.sleep(0.7)
    print ""

    result = idleStatus.result()
    if result == mscl.SetToIdleStatus.setToIdleResult_success:
        print "\nNode now stoped and in Idle mode"
    elif result == mscl.SetToIdleStatus.setToIdleResult_canceled:
        print "\nSet to Idle was canceled"
    else:
        print "\nSet to Idle failed"





connection = mscl.Connection.Serial(sys.argv[1], 921600)

basestation = mscl.BaseStation(connection)

node = mscl.WirelessNode(int(sys.argv[2]), basestation)

node_set_idle(node)

response = node.ping()

if response.success():
    print response.baseRssi()
    print response.nodeRssi()


time.sleep(0.5)
print node.getNumDatalogSessions()
time.sleep(0.5)

print node.getNumSweeps()

time.sleep(1)
time.sleep(1)


config = mscl.WirelessNodeConfig()
#config.bootMode(mscl.WirelessTypes.bootMode_normal)
#config.inactivityTimeout(7200)
config.samplingMode(mscl.WirelessTypes.samplingMode_nonSync)
config.sampleRate(mscl.WirelessTypes.sampleRate_16Hz) #sampleRate_16Hz)
#config.unlimitedDuration(True)


while True:
    try:
        #node_set_idle(node)
        #time.sleep(0.8)
        node.applyConfig(config)
        time.sleep(1)
    except (mscl.Error_InvalidNodeConfig, mscl.Error_Communication), e:
        print e
        continue
    break

print node.startNonSyncSampling()

When I run the script I got:

Attemting to set in Idle mode node
..

Node now stoped and in Idle mode
-36
-32
0
100
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.
Invalid Configuration.

Am I doing right the configuration?
Best Regards.

Getting hardware Gain and bits resolution

Reading the CHANGELOG, I've realised that getHardwareGain() is not longer available. So I'm wondering how can I get the hardware Gain from a specific channel? and also, there is any way to get the bit resolution?

Thanks, and best regards.

Error when Downloading Armed Datalogging Data

At random (typically during longer automated tests), nodes will return the following errors:

Error_NodeCommunication: Failed to download data from the Node.
Error_NodeCommunication: Failed to read EEPROM 0 from Node 584

It doesn't happen all the time or in fixed test intervals, so I'm not sure what's causing the bug. Any thoughts/suggestions?

Getting angles from Inertial Node

I'm using MSCL with an Inertial node 3DM-GX3 -15-OEM, which contains an accelerometer and a gyroscope. From what I understood reading the MIP Data Communications Protocol to get the device angle I have to use the InertialType's ChannelField CH_FIELD_SENSOR_DELTA_THETA_VEC.

Here I paste test code to get the accelerations and angles. But I get the following error:

  File "testangle.py", line 23, in <module>
    node.setActiveChannelFields(mscl.InertialTypes.CATEGORY_SENSOR, chs)
  File "/home/pi/mscl/lin_mscl.py", line 2738, in setActiveChannelFields
    def setActiveChannelFields(self, *args): return _mscl.InertialNode_setActiveChannelFields(self, *args)
mscl.lin_mscl.Error_InertialCmdFailed: The Sensor Message Format command has failed.

I realize that this error disappears when I change the sample rate for the theta_vector channel to 64Hz. But in my application I need to sample at 1Hz.

What I'm missing?

Best regards.

Error codes with simple calls

Hello,
We are having problems with some basic interacting with the 3DM-GX5-25.
We have taken the sample code from the quick start guide, but the code fails at the point where we call
node.setActiveChannelFields . This call throws an mscl::Error_MipCmdFailed, with an error code 4. We only took the code relevant to the AHRS component.

Then we tried to see more of the state of the device, and we made a call to node.getBasicDeviceStatus() right after initiating the node with a connection that succeeds when pinging. This getBasicDeviceStatus call throws an execption, again of type Error_MipCmdFailed, but with an error code 3.

Code we use is available in this gist https://gist.github.com/tjtolon/d7f25c9a911f37a9c738c02eeb1ae117

Best Regards,
Tatu

Linux Operating System

is it possible to run this program in Linux OS ? by using "make file", in the case it can work. Is the code available ?
can I read the data from Multi-Inertia sensors simultaneously ?
thanks in advance.

MSCL on ARM platforms

Has anyone tried it over an ARM platform?

How do you compile it for ARM?

Best regards.

unable to read value returned by getNodeNetworkInfo

I am trying to get the node information by using :
network=mscl.SyncSamplingNetwork(baseStation)
print(network.getNodeNetworkInfo (node_address))

I am getting the output as:
Network info <mscl.SyncNetworkInfo; proxy of <Swig Object of type 'mscl::SyncNetworkInfo *" at 0x000001DCA11D3B10>>

What does this mean and how to make it readable?

Your library doesn't compile correctly under linux.

How the archive size can be less than 1 byte?!
Your library does not possible to compile. Please fix it as soon as possible!

Dump:
1 folder, 0 files, 0 bytes
Creating archive: ../Output/Examples.zip
Items to compress: 1
Files read from disk: 0
Archive size: 152 bytes (1 KiB)
Everything is Ok
(zipOutput.sh) Removing temp directory that was zipped
(zipOutput.sh) DONE

(buildAll.sh) DONE

Set to Idle cancel operation fails

When you call cancel() on the SetToIdleStatus object, it performs a Base Station ping command to cancel the operation (any bytes sent to the Base Station cancels it).

However, with the recent addition of v2 of the ping command, MSCL has to check the firmware version of the BaseStation before it knows which ping command to send. This isn't the correct behavior for canceling set to idle.

Change to canceling the set to idle in another method.

High CPU usage when reading data

Hi,

We're reading from 2 sensors using the python 2.7 swig wrapper api. On both sensors we're sampling at 512Hz with a synchronization network on all 3 channels. One issue we're seeing is a high CPU utilization rate when looping through the sweeps and then the data points for each sensor.

Attached is the code we're using to perform the reading of the sensors. The readRobotVibrationsData in the LordMicroStrainReader.txt is the method we're calling. Also attached is the cProfile log, it was created by running the attached Test.txt and calling the readRobotVibrationsData in the LordMicroStrainReader.txt. In the Test we're calling the readRobotVibrationsData only once but for the application we're creating we're calling the readRobotVibrationsData every 500 milliseconds.

A couple of questions:
1.) Is there a way to get the data without having to loop through each data point?
2.) Also, when looking at the cProfile I noticed the call to get the channel Name using the dataPoint.channelName() seems expensive. Are we guaranteed the dataPoints to be sequential for each sweep, so the first datapoint would be Ch1, second datapoint Ch2, and third data point Ch3? The reason I ask so we wouldn't need to call the dataPoint.channelName().
3.) If we very the size of the internal circular buffer would we see any performance improvement?
So by changing the MAX_DATA_BUFFER_SIZE to something smaller.
4.) When api is reading the data from the sensor base station to the internal buffer is that a blocking call? So, if I'm calling getData() on the BaseStation object is that blocked while the internal circularbuffer is being written to?

Thanks,
Kate

cProfile.txt
Test.txt
LordMicroStrainReader.txt

Python _mscl.pyd file

Trying to do a python script to collect the data from the WSDA aggregator on a linux machine. The file _mscl.pyd only runs in windows. Is there an equivalent file for linux or a work around? when I tried to import the mscl.py file it gives an error the following error: ImportError: No module named _mscl

vtable error

Hello,
I recently tried recompiling and I am getting this error

main.cpp:(.text._ZN4mscl12InertialNodeD2Ev[_ZN4mscl12InertialNodeD5Ev]+0xc): undefined reference to `vtable for mscl::InertialNode'
main.cpp:(.text._ZN4mscl12InertialNodeD2Ev[_ZN4mscl12InertialNodeD5Ev]+0x10): undefined reference to `vtable for mscl::InertialNode'

I am stumped.

WSDA Base unavailable after long use.

I'm using mscl to read data from wireless nodes (glink2, dvrt-link, etc.), these nodes are monitoring for long time. What I found is that sometimes the WSDA Base stops working, I got errors about reading the EPROM. I close my reading program and check the base and nodes from NodeCommander but it appears as unavailable and the only way to get it work is unplug and plug again.

Have you experienced that? Do you have some sort of protocol of how one should start reading and stop the nodes? maybe some good practices handling the nodes?

Thanks,
Best regards.

Python import error MSCL_32.8.3

I'm running Fedora 27, with Python 3.6.4. When I try to import the mscl library I get the error below. It works without issues on Windows 7 using the same version of python.

Can anyone reproduce this? Is it a swig problem?

import mscl

ModuleNotFoundError Traceback (most recent call last)
~/Downloads/Python3.6/x64/mscl.py in swig_import_helper()
13 try:
---> 14 return importlib.import_module(mname)
15 except ImportError:

/usr/lib64/python3.6/importlib/init.py in import_module(name, package)
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
127

/usr/lib64/python3.6/importlib/_bootstrap.py in _gcd_import(name, package, level)

/usr/lib64/python3.6/importlib/_bootstrap.py in find_and_load(name, import)

/usr/lib64/python3.6/importlib/_bootstrap.py in find_and_load_unlocked(name, import)

ModuleNotFoundError: No module named '_mscl'

During handling of the above exception, another exception occurred:

ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 import mscl

~/Downloads/Python3.6/x64/mscl.py in ()
15 except ImportError:
16 return importlib.import_module('_mscl')
---> 17 _mscl = swig_import_helper()
18 del swig_import_helper
19 elif _swig_python_version_info >= (2, 6, 0):

~/Downloads/Python3.6/x64/mscl.py in swig_import_helper()
14 return importlib.import_module(mname)
15 except ImportError:
---> 16 return importlib.import_module('_mscl')
17 _mscl = swig_import_helper()
18 del swig_import_helper

/usr/lib64/python3.6/importlib/init.py in import_module(name, package)
124 break
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
127
128

ModuleNotFoundError: No module named '_mscl'

Issue with setActiveChannelFields

Hi, I am pretty new to python and i am trying to set up a 3DM-GX5-15 to constantly stream values, in this case euler angles. I can successfully connect and ping the device but i am haing troubble with the setActiveChannelFields function. I am getting the error shown below

image

It looks like the error says the function needs 3 arguments but in the documentation it only shows 2

Do you have any ideas on how to solve this? my code is below.
Also how would i set the device to stream two values ex. euler angles and linear accelerations?

Thank you for the help,

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

import mscl
import misc

try:
   
    
        connection = mscl.Connection.TcpIp("10.0.1.53",10001)
        #create the InertialNode, passing in the connection
        node = mscl.InertialNode(connection)
        pingSuccess=node.ping()#test is already connected to imu
        if pingSuccess==True:# only reconnect if not already connected
             print misc.GREEN + "ping success" + misc.ENDC
        else:
            print misc.RED + "ping failed" + misc.ENDC
            
                     
        node.setToIdle()#set the accelerometer to idle so it can be configured
        
        

        sampleRate1=mscl.SampleRate(1,100)# mode 1=hertz, 100 hertz
      
        MipChannel1=mscl.MipChannel(0x8205,sampleRate1)#euler angles for channel 1
              

       node.setActiveChannelFields(0x80,MipChannel1)#need to fix this
             
except mscl.Error, e:
    
        print(e)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.