LORD-MicroStrain / MSCL

MicroStrain Communication Library
https://www.microstrain.com/software/mscl
MIT License
76 stars 57 forks source link

question about getting "CH_FIELD_SENSOR_RAW_GYRO_VEC" #389

Open sizsJEon opened 4 months ago

sizsJEon commented 4 months ago

I'm trying to get the gyroscope sensor values via "CH_FIELD_SENSOR_SCALED_GYRO_VEC"

but I can't get the scaled value for it, so I was thinking about getting real sensor value via "CH_FIELD_SENSOR_RAW_GYRO_VEC"

but below code give me a error like

MSCL Version : 62.0.0 rawGyro push euler push setActiveChannelFields terminate called after throwing an instance of 'mscl::Error_MipCmdFailed' what(): The MessageFormat command has failed. (Error Code: 3)

CH_FIELD_SENSOR_RAW_GYRO_VEC are not supported in CLASS_AHRS_IMU? it so, what class I should use for ?

    static float IMUdata;
    std::string str = " ";
    std::cout << "MSCL Version : " << mscl::MSCL_VERSION.str() << std::endl;
    mscl::Connection connection = mscl::Connection::Serial("/dev/ttyACM0", 115200);
    mscl::InertialNode node(connection);
    uint32_t samples_per_second = 500;

    if (node.features().supportsCategory(mscl::MipTypes::CLASS_AHRS_IMU))
    {
      mscl::MipChannels ahrsImuChs;
      ahrsImuChs.push_back(mscl::MipChannel(mscl::MipTypes::CH_FIELD_SENSOR_RAW_GYRO_VEC,
                                                  mscl::SampleRate::Hertz(samples_per_second)));
      std::cout<<"rawGyro push"<<std::endl;

      ahrsImuChs.push_back(mscl::MipChannel(mscl::MipTypes::CH_FIELD_SENSOR_EULER_ANGLES,
                                                  mscl::SampleRate::Hertz(samples_per_second)));
      std::cout<<"euler push"<<std::endl;
      // ahrsImuChs.push_back(mscl::MipChannel(mscl::MipTypes::CH_FIELD_SENSOR_SCALED_GYRO_VEC,
      //                                       mscl::SampleRate::Hertz(samples_per_second)));
      // ahrsImuChs.push_back(mscl::MipChannel(mscl::MipTypes::CH_FIELD_ESTFILTER_ESTIMATED_ORIENT_EULER,
      //                                       mscl::SampleRate::Hertz(samples_per_second)));
      // apply to the node
      std::cout<<"setActiveChannelFields"<<std::endl;
      node.setActiveChannelFields(mscl::MipTypes::CLASS_AHRS_IMU, ahrsImuChs);
      std::cout<<"setActiveChannelFields done"<<std::endl;
    }
    // start sampling

    node.enableDataStream(mscl::MipTypes::CLASS_AHRS_IMU);
    std::cout<<"enableDataStream"<<std::endl;