Comments (10)
Can you explain more of what you mean by "unable to access sweep.data()"?
Does the python program throw an error on that line?
from mscl.
I have been trying following the example codes and I made like :
`import sys
sys.path.append("../../dependencies/Python")
import mscl
COM_PORT = "COM12"
NODE_ADDRESS = 31905
try:
# create a SerialConnection with the specified COM Port, default baud rate of 921600
connection = mscl.Connection.Serial(COM_PORT)
# create a BaseStation with the connection
baseStation = mscl.BaseStation(connection)
# create a WirelessNode with the BaseStation we created
node = mscl.WirelessNode(NODE_ADDRESS, baseStation)
# create a SyncSamplingNetwork object, giving it the BaseStation that will be the master BaseStation for the network
network = mscl.SyncSamplingNetwork(baseStation)
# add a WirelessNode to the network
print "Adding node to the network...",
network.addNode(node)
print "Done."
# can get information about the network
print "Network info: "
print "Network OK: ", network.ok()
print "Percent of Bandwidth: ", network.percentBandwidth()
print "Lossless Enabled: ", network.lossless()
print "High Capacity Mode: ", network.highCapacity()
# apply the network configuration to every node in the network
print "Applying network configuration",
network.applyConfiguration()
print "Done."
print "Starting the network...",
network.startSampling_noBeacon()
print "Done."
while True:
sweeps = baseStation.getData(500)
for sweep in sweeps:
# print out information about the sweep
print "Packet Received",
print "Node", sweep.nodeAddress(),
print "Timestamp", sweep.timestamp(),
print "Tick", sweep.tick(),
print "Sample Rate", sweep.sampleRate().prettyStr(),
print "Base RSSI: ", sweep.baseRssi(),
print "Node RSSI: ", sweep.nodeRssi(),
print "DATA: ",
# iterate over each point in the sweep
for dataPoint in sweep.data():
# just printing this out as a string. Other methods (ie. as_float, as_uint16) are also available.
print dataPoint.channelName(), ":", dataPoint.as_string(),
print ""
print sweep.data()
except Exception, e:
print "Error:", e `
Here, my trouble is I am unable to read acceleration data which is supposed to stored in each 500 millisecond. How can I get the acceleration data while program is running an infinite loop?
from mscl.
It looks like the Node might not actually be sampling.
You are using the startSampling_noBeacon()
function from the SyncSamplingNetwork
class.
When using this function, the beacon does not get enabled. The nodes will be "started", but waiting to hear from a beacon to actually start sending data.
In most cases, you will want to use the startSampling()
function. This will start the nodes, and enable the beacon.
Alternatively, you can still use the startSampling_noBeacon()
function, and then later enable the beacon via the BaseStation
enableBeacon()
function.
from mscl.
Just realized that the example Python code uses that same startSampling_noBeacon
function when it was meant to just use the startSampling
function. I will fix this to get rid of the confusion.
from mscl.
Thank you @rwslord. The data is streaming but I am unable find the acceleration value in unit 'g'. What is the command to read acceleration ?
at present I am getting like
`Packet Received Node 31905 Timestamp 2016-06-13 05:44:28.001750000 Tick 0 Sample Rate 128Hz Base RSSI: -16 Node RSSI: -23 DATA: ch3 : 1200 *' at 0x018700C8> >
Packet Received Node 31905 Timestamp 2016-06-13 05:44:28.009562500 Tick 1 Sample Rate 128Hz Base RSSI: -16 Node RSSI: -23 DATA: ch3 : 1202 *' at 0x01925B18> >
Packet Received Node 31905 Timestamp 2016-06-13 05:44:28.017375000 Tick 3 Sample Rate 128Hz Base RSSI: -16 Node RSSI: -23 DATA: ch3 : 1202 *' at 0x018700C8> >`
from mscl.
Ok, so you can see you are getting data for 'ch3'. I'm guessing this is the only channel you have enabled on the Node. I'm not sure what type of Node you have, but if this is a G-Link, ch3 is Acceleration - Z. Enabling ch1 and ch2 would get you Accel - X and Accel - Y respectively.
The data values are around 1200. This looks like it is in raw bits, so the Node is likely set up to send uint16, uncalibrated data. Setting the DataFormat to dataFormat_4byte_float
will tell the Node to send calibrated data over the air. This will use whatever Calibration Coefficients are stored on the Node for each channel. (If this is a G-Link, it was calibrated here before you received it.)
from mscl.
Thank you @rwslord. I am using 'G-Link-LXRS' and wish to read only channel 3 data. I tried to follow your instruction but unable implement. Can you please tell me in which place I have to edit the code and what will be the command?
from mscl.
The ConfigureNode.py example shows how to get and set configuration settings for a Node. Specifically for your case, look at the setCurrentConfig
function in that example.
What you need to do is use the WirelessNodeConfig
object and use the dataFormat
function, passing in mscl.WirelessTypes.dataFormat_4byte_float
. Then take that WirelessNodeConfig
and apply it to the WirelessNode
:
# create a WirelessNodeConfig which is used to set all node configuration options
config = mscl.WirelessNodeConfig()
# set the configuration options that we want to change
config.dataFormat(mscl.WirelessTypes.dataFormat_4byte_float)
# attempt to verify the configuration with the Node we want to apply it to
# Note that this step is not required before applying, however the apply will throw an
# Error_InvalidNodeConfig exception if the config fails to verify.
issues = mscl.ConfigIssues()
if not node.verifyConfig(config, issues):
print "Failed to verify the configuration. The following issues were found:"
# print out all of the issues that were found
for issue in issues:
print issue.description()
print "Configuration will not be applied."
else:
# apply the configuration to the Node
node.applyConfig(config)
Note that once this configuration setting is applied to the Node, the Node will remember this even on power cycle. So unless you want to change configuration settings for each run of your program, you can just do this once and remove it. Setting this value via Node Commander / SensorConnect would achieve the same result. Once this value is set, you should receive the calibrated G's over the air, instead of bits.
from mscl.
Thank you very much @rwslord. It's working.
from mscl.
That's great to hear 😃
from mscl.
Related Issues (20)
- 2 receivers on same usb hub
- Unable to retirieve data, but can ping it
- 3DMGX5 and MCTL HOT 1
- How can I write / read the MIP stream to a binary file, but still leverage MSCL's parsing? HOT 2
- Will Connection::Tcpip work with my own proxy application? HOT 2
- 3DM-GQ7 GNSS/INS device not reconized on m1 macos HOT 1
- node connection (WSDA-200-USB with node adress 57233) HOT 2
- Problem using 3DMCV7-AHRS with Raspberry Pi 3B+ HOT 3
- 3DM-GV7-AHRS Supported Commands and Pulling RPY
- Failed to read the Model Number (EEPROM 46) from Node HOT 2
- Datalog Download from Nodes fail despite generous amount of retries and timeouts
- Read ed estract data from device with script python
- [3DM-CV7-AHRS] Serial communication with raspberry pi using usb cable
- 3DM CV7-AHRS activate trigger HOT 2
- 3DMGQ7 cdc_adm: failed to set dtr/rts, then Error: Failed to communicate with device
- [3DMCV7-AHRS] PPS in GPIO setup HOT 2
- 3DMCV7-AR with setSensorToVehicleRotation_matrix issue HOT 1
- GNSS Heading Updates API call failure
- Raspberry pi5 | ImportError: /_mscl.so: ELF load command address/offset not page-aligned HOT 2
- Error: openssl related issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mscl.