Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added magnetometer, pressure, temperature, and wind speed information to new message navdata2 #2

Merged
merged 8 commits into from
Aug 1, 2012
Prev Previous commit
Next Next commit
ARDrone 2 video no longer publishes if there are no subscribers.
younata committed Jul 27, 2012

Verified

This commit was signed with the committer’s verified signature.
davidmigloz David Miguel Lozano
commit cdf41f304c7175e8e222e78fd55a6f22da150bee
16 changes: 12 additions & 4 deletions src/ardrone_driver.cpp
Original file line number Diff line number Diff line change
@@ -59,6 +59,12 @@ double ARDroneDriver::getRosParam(char* param, double defaultVal)

void ARDroneDriver::publish_video()
{
if (image_pub.getNumSubscribers() == 0)
return;
if (hori_pub.getNumSubscribers() == 0)
return;
if (vert_pub.getNumSubscribers() == 0)
return;
if (IS_ARDRONE1)
{
/*
@@ -229,6 +235,8 @@ void ARDroneDriver::publish_video()
*/
if (IS_ARDRONE2)
{
if (hori_pub.getNumSubscribers() == 0 || vert_pub.getNumSubscribers() == 0)
return;
sensor_msgs::Image image_msg;
sensor_msgs::CameraInfo cinfo_msg;
sensor_msgs::Image::_data_type::iterator _it;
@@ -265,8 +273,8 @@ void ARDroneDriver::publish_video()

void ARDroneDriver::publish_navdata()
{
if (navdata.getNumSubscribers() == 0)
return // why bother, no one is listening.
if (navdata_pub.getNumSubscribers() == 0)
return; // why bother, no one is listening.
ardrone_autonomy::Navdata msg;

msg.batteryPercent = navdata.vbat_flying_percentage;
@@ -321,8 +329,8 @@ void ARDroneDriver::publish_navdata()

void ARDroneDriver::publish_navdata2()
{
if (navdata2.getNumSubscribers() == 0)
return // why bother, no one is listening.
if (navdata2_pub.getNumSubscribers() == 0)
return; // why bother, no one is listening.
ardrone_autonomy::Navdata2 msg;

msg.batteryPercent = navdata.vbat_flying_percentage;