Class AdiImuBufRos2

Class Documentation

class AdiImuBufRos2

Class for ADI IMU + ADRD2121.

Public Functions

AdiImuBufRos2(const rclcpp::Node::SharedPtr &node)

Constructor for AdiImuBufRos2.

~AdiImuBufRos2()

Destructor for AdiImuBufRos2.

void initParams(void)

Loads ROS-related, ADI IMU (AdiImuRos2), and ADRD2121 (ImuBufRos2) parameters.

bool init(void)

Initializes the hardware Initializes the (1) communication with the board (i.e via USB), (2) ADRD2121, ADI IMU, and (4) advertises ROS Publishers and Service Servers.

bool config(void)

Configures the hardware based on the loaded parameters Configure the (1) ADRD2121, and (2) ADI IMU Also, sets the appropriate ROS Loop rate.

Returns:

Boolean if successful (true) or not (false)

void readPubData(void)

Acquire publisher rate and advertise wall timer for looping.

void dataReadAndPubCB(void)

Callback being called by wall timer to read and publish IMU data.

double getRosLoopRateHz(void)

Return ROS Loop Rate set during config.

Returns:

ROS Loop Rate in Hz

bool triggerImuGlobCmd(adrd2121_imu::srv::ImuGlobCmd::Request::SharedPtr req, adrd2121_imu::srv::ImuGlobCmd::Response::SharedPtr res)

Service Server callback for imu_glob_cmd_service_.

Parameters:

req, res – Request and Response to the Service

Returns:

Boolean if successful (true) or not (false)

Public Members

rclcpp::Service<adrd2121_imu::srv::ImuGlobCmd>::SharedPtr p_imu_glob_cmd_service_

ROS2 Service Server to send commands to GLOB_CMD register of ADI IMU.

uint8_t mode_of_operation_

Determine what operation mode will the node run on.

1: STREAM

2: CONFIG

bool b_getHWInitialized_

Checks if at least the HW is initialized.

bool b_readPubDataSuccess

Boolean for checking if ReadPubData call is successful.