Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with setActiveChannelFields #42

Closed
ntaylorBMT opened this issue Mar 6, 2018 · 2 comments
Closed

Issue with setActiveChannelFields #42

ntaylorBMT opened this issue Mar 6, 2018 · 2 comments

Comments

@ntaylorBMT
Copy link

ntaylorBMT commented Mar 6, 2018

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)
@rwslord
Copy link
Contributor

rwslord commented Mar 6, 2018

The setActiveChannelFields actually takes a MipChannels (note the 's') as a second parameter. You are passing it a single MipChannel.

You want to do something like the following:

mipChannel1 = mscl.MipChannel(mscl.MipTypes.CH_FIELD_ESTFILTER_ESTIMATED_ORIENT_EULER, mscl.SampleRate.Hertz(100))

chs = mscl.MipChannels()

chs.append(mipChannel1)
#append more 'mscl.MipChannel' objects to 'chs' as necessary

One other thing to note (that I'd like to abstract and make better in the future), is that the setActiveChannelFields function needs to be called once per mscl.MipTypes.DataClass that you want to change. For instance, the function will error out if you try to set Estimation Filter channel fields for the mscl.MipTypes.CLASS_AHRS_IMU Data Class, which is what it looks like your code was doing as well.

@ntaylorBMT
Copy link
Author

It worked. Thank you for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants