Hello @arjunsengupta98,
This is the IMU proto :
# Message published by an inertial measurement unit (IMU)
struct ImuProto {
# The linear acceleration of the body frame along the primary axes
linearAccelerationX @0: Float32;
linearAccelerationY @1: Float32;
linearAccelerationZ @2: Float32;
# The angular velocity of the body frame around the primary axes
angularVelocityX @3: Float32;
angularVelocityY @4: Float32;
angularVelocityZ @5: Float32;
# Optional angles as integrated by a potential internal estimator
angleYaw @6: Float32;
anglePitch @7: Float32;
angleRoll @8: Float32;
}
You can feed the imu proto to the svo node with this edge :
{
"source": "zed/ZedImuReader/imu_raw",
"target": "tracker/StereoVisualOdometry/imu"
},
If you use a BMI160 :
- please follow this
- and take a look at the imu.app.json in Isaac\apps\samples\imu
If you don’t use a bmi160 you need (I’m probably making some typo there but this the general idea) :
{
"name": "my_imu",
"components": [
{
"name": "isaac.alice.MessageLedger",
"type": "isaac::alice::MessageLedger"
},
{
"name": "my_imu",
"type": "isaac::my_imu"
}
]
}
{
"source": "zed/ZedImuReader/imu_raw",
"target": "my_imu"
},
#pragma once
#include "messages/imu.capnp.h"
namespace isaac {
class my_imu : public alice::Codelet {
public:
void start() override;
void tick() override;
ISAAC_PROTO_RX(ImuProto, start_trigger);
ISAAC_PROTO_TX(ImuProto, my_imu_out);
};} // namespace isaac
ISAAC_ALICE_REGISTER_CODELET(isaac::my_imu);
#include "my_imu.hpp"
#include <memory>
#include <utility>
#include "engine/core/assert.hpp"
namespace isaac {
void my_imu::start() {tickOnMessage(rx_start_trigger());}
void my_imu::tick() {
auto my_imu_proto = tx_my_imu_out().initProto();
Float32 my_data[9]={0,0,0,0,0,0,0,0,0};
//Fill your data here
//my_data = My_i2c_function();//TODO
my_data = My_serial_function();//TODO
//set the ImuProto
my_imu_proto.setLinearAccelerationX = my_data[0];
my_imu_proto.setLinearAccelerationY = my_data[1];
my_imu_proto.setLinearAccelerationZ = my_data[2];
my_imu_proto.setAngularVelocityX = my_data[3];
my_imu_proto.setAngularVelocityY = my_data[4];
my_imu_proto.setAngularVelocityZ = my_data[5];
//Optional angles as integrated by a potential internal estimator
/*my_imu_proto.angleYaw = my_data[0];
my_imu_proto.anglePitch = my_data[0];
my_imu_proto.angleRoll = my_data[0];*/
//Publish ImuProto
tx_my_imu_out().publish(rx_start_trigger.acqtime());
}} // namespace isaac
load("//engine/build:isaac.bzl", "isaac_app", "isaac_py_app", "isaac_cc_module")
isaac_cc_module(
name = "my_imu",
srcs = ["my_imu.cpp"],
hdrs = ["my_imu.hpp"],
visibility = ["//visibility:public"],
deps = ["//engine/core/math",],
)
In two weeks I will receive an I2C IMU (currently using serial IMU) so I could send you my svo project including the I2C part and a clean working code (the one above is not tested yet) if you are waiting 2 weeks.
Regards,
Planktos