Closed MrCCaesar closed 1 year ago
I want to use imu data in my project.But I don't konw how to get imu measurement.I have add
<link name="ti_660"> <sensor name="imu" type="imu" update_rate="400"> <origin rpy="0.0 0.0 0.0" xyz="0 0 0"/> <limit acc_limit="50" ang_vel_limit="40"/> </sensor> </link> <joint name="pelvic_imu" type="fixed"> <origin xyz="0 0 0" rpy="0 0 0" /> <parent link="pelvic" /> <child link="ti_660" /> </joint>
in my urdf file.And i find out I can use robot->getSensors() method to get a unorderedmap of sensors, one of them named ti_660:imu, but i can't find any method in the second object,type std::shared_ptr to get linear acceleration or angular velocity. And in this link https://github.com/raisimTech/raisimLib/blob/master/raisim/linux/include/raisim/sensors/InertialMeasurementUnit.hpp, I found there is a imu class. so I tried
robot->getSensors()
raisim::InertialMeasurementUnit::ImuProperties imuProp; imuProp.maxAcc = 100; imuProp.maxAngVel = 100; imuProp.name = "ti660"; imuProp.noiseType = imuProp.stringToNoiseType("gaussian"); imuProp.mean = 0.0; imuProp.std = 0.01; raisim::InertialMeasurementUnit imu(imuProp, robot.get(), Eigen::Vector3d(0.0, 0.0, 0.72), Eigen::Matrix3d::Identity()); while(1) { ... imu.update(world); imu.getLinearAcceleration(); imu.getAngularVelocity(); ... server.integrateWorldThreadSafe(); }
But i got acceleration and angular velocity are always zero. What should be the right way to get imu measurements in raisim? Thanks.
did you check out the sensor.cpp example?
Thanks, that works
I want to use imu data in my project.But I don't konw how to get imu measurement.I have add
in my urdf file.And i find out I can use to get linear acceleration or angular velocity.
And in this link https://github.com/raisimTech/raisimLib/blob/master/raisim/linux/include/raisim/sensors/InertialMeasurementUnit.hpp, I found there is a imu class. so I tried
robot->getSensors()
method to get a unorderedmap of sensors, one of them named ti_660:imu, but i can't find any method in the second object,type std::shared_ptrBut i got acceleration and angular velocity are always zero. What should be the right way to get imu measurements in raisim? Thanks.