21 #include "sensor_msgs/Imu.h" 22 #include "sensor_msgs/MagneticField.h" 24 #include "lpsensor/LpmsSensorI.h" 25 #include "lpsensor/LpmsSensorManagerI.h" 27 #include "timesync/TimestampSynchronizer.h" 39 device_map = {{
"DEVICE_LPMS_B", DEVICE_LPMS_B},
40 {
"DEVICE_LPMS_U", DEVICE_LPMS_U},
41 {
"DEVICE_LPMS_C", DEVICE_LPMS_C},
42 {
"DEVICE_LPMS_BLE", DEVICE_LPMS_BLE},
43 {
"DEVICE_LPMS_RS232", DEVICE_LPMS_RS232},
44 {
"DEVICE_LPMS_B2", DEVICE_LPMS_B2},
45 {
"DEVICE_LPMS_U2", DEVICE_LPMS_U2},
46 {
"DEVICE_LPMS_C2", DEVICE_LPMS_C2}};
58 manager = LpmsSensorManagerFactory();
64 TimestampSynchronizer::Options defaultSyncOptions;
65 defaultSyncOptions.useMedianFilter =
true;
66 defaultSyncOptions.medianFilterWindow = 1500;
67 defaultSyncOptions.useHoltWinters =
true;
68 defaultSyncOptions.alfa_HoltWinters = 4e-4;
69 defaultSyncOptions.beta_HoltWinters = 3e-4;
70 defaultSyncOptions.alfa_HoltWinters_early = 5e-2;
71 defaultSyncOptions.beta_HoltWinters_early = 1e-3;
72 defaultSyncOptions.earlyClamp =
true;
73 defaultSyncOptions.earlyClampWindow = 120*200;
74 defaultSyncOptions.timeOffset = 0.0;
75 defaultSyncOptions.initialB_HoltWinters = -3.4e-7;
88 if (
imu->getConnectionStatus() == SENSOR_CONNECTION_CONNECTED &&
107 imu_msg.angular_velocity.x =
data.g[0]*3.1415926/180;
108 imu_msg.angular_velocity.y =
data.g[1]*3.1415926/180;
109 imu_msg.angular_velocity.z =
data.g[2]*3.1415926/180;
171 int main(
int argc,
char *argv[])
std::unique_ptr< TimestampSynchronizer > pstampSynchronizer
void publish(const boost::shared_ptr< M > &message) const
int main(int argc, char *argv[])
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
std::map< std::string, int > device_map
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
LpmsSensorManagerI * manager
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::NodeHandle private_nh
Manages connection with the sensor, publishes data.
void update(const ros::TimerEvent &te)
sensor_msgs::MagneticField mag_msg