11#define M_PI (3.14159265358979323846)
20 ok = m_poly->
view(m_iThreeAxisGyroscopes);
25 ok = m_poly->view(m_iThreeAxisLinearAccelerometers);
30 ok = m_poly->view(m_iThreeAxisMagnetometers);
35 ok = m_poly->view(m_iOrientationSensors);
41 ok = m_iThreeAxisGyroscopes->getThreeAxisGyroscopeFrameName(m_sens_index, m_framename);
60 imu_ros_data.angular_velocity.x = vecgyr[0] *
M_PI / 180.0;
61 imu_ros_data.angular_velocity.y = vecgyr[1] *
M_PI / 180.0;
62 imu_ros_data.angular_velocity.z = vecgyr[2] *
M_PI / 180.0;
63 imu_ros_data.linear_acceleration.x = vecacc[0];
64 imu_ros_data.linear_acceleration.y = vecacc[1];
65 imu_ros_data.linear_acceleration.z = vecacc[2];
66 vecrpy[0] = vecrpy[0] *
M_PI / 180.0;
67 vecrpy[1] = vecrpy[1] *
M_PI / 180.0;
68 vecrpy[2] = vecrpy[2] *
M_PI / 180.0;
71 imu_ros_data.orientation.x = q.
x();
72 imu_ros_data.orientation.y = q.
y();
73 imu_ros_data.orientation.z = q.
z();
74 imu_ros_data.orientation.w = q.
w();
const yarp::os::LogComponent & GENERICSENSORROSPUBLISHER()
yarp::os::Publisher< yarp::rosmsg::sensor_msgs::Imu > m_publisher
const size_t m_sens_index
IMURosPublisher: This wrapper connects to a device and publishes a ROS topic of type sensor_msgs::Imu...
void run() override
Loop function.
bool view(T *&x)
Get an interface to the device driver.
virtual bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &rpy, double ×tamp) const =0
Get the last reading of the orientation sensor as roll pitch yaw.
virtual bool getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector &out, double ×tamp) const =0
Get the last reading of the gyroscope.
virtual bool getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector &out, double ×tamp) const =0
Get the last reading of the specified sensor.
void fromRotationMatrix(const yarp::sig::Matrix &R)
Converts a rotation matrix to a quaternion.
bool isOpen() const
Check if the port has been opened.
Port & asPort() override
Get the concrete Port being used for communication.
void write(bool forceStrict=false)
Write the current object being returned by Publisher::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::Publisher::write.
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
yarp::sig::Matrix rpy2dcm(const yarp::sig::Vector &rpy)
Converts roll-pitch-yaw angles in the corresponding dcm (direction cosine matrix) rotation matrix (de...