4 #include <nav_msgs/Odometry.h> 5 #include "../include/yocto/yocto_api/yocto_altitude.h" 6 #include "../include/yocto/yocto_api/yocto_api.h" 7 #include "../include/yocto/yocto_api/yocto_genericsensor.h" 8 #include "../include/yocto/yocto_api/yocto_temperature.h" 9 #include <yoctopuce_altimeter/yocto_msg.h> 11 int main (
int argc,
char *argv[])
13 ros::init(argc, argv,
"altimeter_pub_node");
22 string errmsg, target;
31 std::cerr <<
"RegisterHub error: " << errmsg << std::endl;
53 ROS_ERROR_STREAM(
"Module not connected (check identification and USB cable)");
58 double pressure = asensor->
get_qnh();
59 pressure = pressure * 100.0;
62 yoctopuce_altimeter::yocto_msg raw_msg;
63 nav_msgs::Odometry odom;
65 raw_msg.header.frame_id =
"base_link";
66 raw_msg.altitude = alt;
67 raw_msg.pressure.header.frame_id =
"base_link";
68 raw_msg.pressure.fluid_pressure = pressure;
69 raw_msg.pressure.variance = 0;
70 raw_msg.temperature.header.frame_id =
"base_link";
71 raw_msg.temperature.temperature = temp;
72 raw_msg.temperature.variance = 0;
75 odom.header.frame_id =
"odom";
76 odom.child_frame_id =
"odom";
77 odom.pose.pose.position.z = alt;
78 odom_pub.publish(odom);
YAltitude * yFirstAltitude(void)
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
YTemperature * yFindTemperature(const string &func)
double get_currentValue(void)
YRETCODE ySleep(unsigned ms_duration, string &errmsg)
YAltitude * yFindAltitude(const string &func)
YRETCODE yRegisterHub(const string &url, string &errmsg)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char *argv[])
YTemperature * yFirstTemperature(void)
#define ROS_ERROR_STREAM(args)
ROSCPP_DECL void spinOnce()