25 ROS_INFO(
"Connecting to Watson INS...");
28 ROS_INFO(
"Successfully connected to Watson INS");
33 #define Hour2Sec(H) (H*60*60) 34 #define Min2Sec(H) (H*60) 35 #define TSec2Nanosec(TS) (TS*100*1000) 47 sensor_msgs::NavSatStatus navSatStatus;
48 navSatStatus.status = sensor_msgs::NavSatStatus::STATUS_SBAS_FIX;
50 gpsMsg.status = navSatStatus;
56 #define Degree2Radians(D) (D * M_PI/180) 57 #define Gs2Meters2(G) (G / 0.101972) 60 double roll, pitch, yaw;
61 double x_angular, y_angular, z_angular;
62 double x_accel, y_accel, z_accel;
63 double forward_accel, lateral_accel, vertical_accel;
69 quat_tf.
setRPY(roll, pitch, yaw);
83 imuMsg.linear_acceleration.x =
Gs2Meters2(x_accel);
84 imuMsg.linear_acceleration.y =
Gs2Meters2(y_accel);
85 imuMsg.linear_acceleration.z =
Gs2Meters2(z_accel);
104 sensor_msgs::NavSatFix &fixMsg,
105 bool &validImu,
bool &validFix)
107 validImu = validFix =
false;
115 while (bytesRead <
sizeof(
struct ins_data_t)) {
125 validImu = validFix =
true;
128 ROS_INFO(
"Only IMU data is available");
136 ROS_WARN(
"Calculated altitude/heading error exceeds ranges");
145 ROS_INFO(
"Closing Watson INS Driver");
struct ins_data_t insData
WatsonINSDriver(std::string path, int baud, int timeout_ms)
void read(sensor_msgs::Imu &imuMsg, sensor_msgs::NavSatFix &fixMsg, bool &validImu, bool &validFix)
void setRPY(const tfScalar &roll, const tfScalar &pitch, const tfScalar &yaw)
static void quaternionTFToMsg(const Quaternion &bt, geometry_msgs::Quaternion &msg)
void parseGPS(sensor_msgs::NavSatFix &gpsMsg)
static Timeout simpleTimeout(uint32_t timeout)
size_t read(uint8_t *buffer, size_t size)
#define Degree2Radians(D)
void parseIMU(sensor_msgs::Imu &imuMsg)