Skip to content

Commit

Permalink
Renamed fullspeed_ to realtime_ ... because that's what it is!
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehamer committed Nov 28, 2012
1 parent 7b8a651 commit c1bff20
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions launch/ardrone_aggressive.launch
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@

<!-- Do we want to publish new-style navdata when received (true), or every time the ros-loop runs (false)? -->
<!-- (does not affect legacy navdata, which is always published at ros-loop rate) -->
<param name="fullspeed_navdata" value="true" />
<param name="fullspeed_video" value="true" />
<param name="realtime_navdata" value="true" />
<param name="realtime_video" value="true" />

<!-- Covariance Values (3x3 matrices reshaped to 1x9)-->
<rosparam param="cov/imu_la">[0.1, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.1]</rosparam>
Expand Down
36 changes: 18 additions & 18 deletions src/ardrone_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ void ARDroneDriver::run()
ROS_INFO("Navdata Publish Settings:");
ROS_INFO(" Legacy Mode: %s", enabled_legacy_navdata ? "On" : "Off"); //Bug: This is being inited after in the NavdataMessage*.h
ROS_INFO(" ROS Loop Rate: %d", looprate);
ROS_INFO(" Instant New Navdata Publish: %s", fullspeed_navdata ? "On" : "Off");
ROS_INFO(" Instant New Video Publish: %s", fullspeed_video ? "On" : "Off");
ROS_INFO(" Instant New Navdata Publish: %s", realtime_navdata ? "On" : "Off");
ROS_INFO(" Instant New Video Publish: %s", realtime_video ? "On" : "Off");
ROS_INFO(" Drone Send Speed: %s", ardrone_application_default_config.navdata_demo==0 ? "200Hz (navdata_demo=0)" : "15Hz (navdata_demo=1)");
// TODO: Enabled Navdata Demo
vp_os_mutex_unlock(&navdata_lock);
Expand All @@ -150,7 +150,7 @@ void ARDroneDriver::run()
}
}
} else {
if(!fullspeed_video)
if(!realtime_video)
{
vp_os_mutex_lock(&video_lock);
copy_current_frame_id = current_frame_id;
Expand All @@ -162,7 +162,7 @@ void ARDroneDriver::run()
}
}

if(!fullspeed_navdata)
if(!realtime_navdata)
{
vp_os_mutex_lock(&navdata_lock);
copy_current_navdata_id = current_navdata_id;
Expand Down Expand Up @@ -383,9 +383,9 @@ void ARDroneDriver::publish_video()
image_msg.step = D1_STREAM_WIDTH*3;
image_msg.data.resize(D1_STREAM_WIDTH*D1_STREAM_HEIGHT*3);

if(!fullspeed_video) vp_os_mutex_lock(&video_lock);
if(!realtime_video) vp_os_mutex_lock(&video_lock);
std::copy(buffer, buffer+(D1_STREAM_WIDTH*D1_STREAM_HEIGHT*3), image_msg.data.begin());
if(!fullspeed_video) vp_os_mutex_unlock(&video_lock);
if(!realtime_video) vp_os_mutex_unlock(&video_lock);

if (cam_state == ZAP_CHANNEL_HORI)
{
Expand All @@ -411,14 +411,14 @@ void ARDroneDriver::publish_video()
image_msg.data.clear();
image_msg.data.resize(D1_VERTSTREAM_WIDTH*D1_VERTSTREAM_HEIGHT*3);
_it = image_msg.data.begin();
if(!fullspeed_video) vp_os_mutex_lock(&video_lock);
if(!realtime_video) vp_os_mutex_lock(&video_lock);
for (int row = 0; row < D1_VERTSTREAM_HEIGHT ; row++)
{
int _b = row * D1_STREAM_WIDTH * 3;
int _e = _b + image_msg.step;
_it = std::copy(buffer + _b, buffer + _e, _it);
}
if(!fullspeed_video) vp_os_mutex_unlock(&video_lock);
if(!realtime_video) vp_os_mutex_unlock(&video_lock);

cinfo_msg_vert.width = D1_VERTSTREAM_WIDTH;
cinfo_msg_vert.height = D1_VERTSTREAM_HEIGHT;
Expand All @@ -441,14 +441,14 @@ void ARDroneDriver::publish_video()
image_msg.data.clear();
image_msg.data.resize((D1_STREAM_WIDTH - D1_MODE2_PIP_WIDTH)*D1_STREAM_HEIGHT*3);
_it = image_msg.data.begin();
if(!fullspeed_video) vp_os_mutex_lock(&video_lock);
if(!realtime_video) vp_os_mutex_lock(&video_lock);
for (int row = 0; row < D1_STREAM_HEIGHT; row++)
{
int _b = (row * D1_STREAM_WIDTH * 3) + (D1_MODE2_PIP_WIDTH * 3);
int _e = _b + image_msg.step;
_it = std::copy(buffer + _b, buffer + _e, _it);
}
if(!fullspeed_video) vp_os_mutex_unlock(&video_lock);
if(!realtime_video) vp_os_mutex_unlock(&video_lock);

cinfo_msg_hori.width = D1_STREAM_WIDTH - D1_MODE2_PIP_WIDTH;
cinfo_msg_hori.height = D1_STREAM_HEIGHT;
Expand All @@ -463,14 +463,14 @@ void ARDroneDriver::publish_video()
image_msg.data.clear();
image_msg.data.resize(D1_MODE2_PIP_WIDTH * D1_MODE2_PIP_HEIGHT * 3);
_it = image_msg.data.begin();
if(!fullspeed_video) vp_os_mutex_lock(&video_lock);
if(!realtime_video) vp_os_mutex_lock(&video_lock);
for (int row = 0; row < D1_MODE2_PIP_HEIGHT; row++)
{
int _b = row * D1_STREAM_WIDTH * 3;
int _e = _b + image_msg.step;
_it = std::copy(buffer + _b, buffer + _e, _it);
}
if(!fullspeed_video) vp_os_mutex_unlock(&video_lock);
if(!realtime_video) vp_os_mutex_unlock(&video_lock);

cinfo_msg_vert.width = D1_MODE2_PIP_WIDTH;
cinfo_msg_vert.height = D1_MODE2_PIP_HEIGHT;
Expand All @@ -496,9 +496,9 @@ void ARDroneDriver::publish_video()
{
int _b = (row * (D1_STREAM_WIDTH * 3)) + (D1_MODE3_PIP_WIDTH * 3);
int _e = _b + image_msg.step;
if(!fullspeed_video) vp_os_mutex_lock(&video_lock);
if(!realtime_video) vp_os_mutex_lock(&video_lock);
_it = std::copy(buffer + _b, buffer + _e, _it);
if(!fullspeed_video) vp_os_mutex_unlock(&video_lock);
if(!realtime_video) vp_os_mutex_unlock(&video_lock);
}

cinfo_msg_vert.width = D1_VERTSTREAM_WIDTH - D1_MODE3_PIP_WIDTH;
Expand All @@ -514,13 +514,13 @@ void ARDroneDriver::publish_video()
image_msg.data.clear();
image_msg.data.resize(D1_MODE3_PIP_WIDTH * D1_MODE3_PIP_HEIGHT * 3);
_it = image_msg.data.begin();
if(!fullspeed_video) vp_os_mutex_lock(&video_lock);
if(!realtime_video) vp_os_mutex_lock(&video_lock);
for (int row = 0; row < D1_MODE3_PIP_HEIGHT; row++)
{
int _b = row * D1_STREAM_WIDTH * 3;
int _e = _b + image_msg.step;
_it = std::copy(buffer + _b, buffer + _e, _it);
}if(!fullspeed_video) vp_os_mutex_unlock(&video_lock);
}if(!realtime_video) vp_os_mutex_unlock(&video_lock);

cinfo_msg_hori.width = D1_MODE3_PIP_WIDTH;
cinfo_msg_hori.height = D1_MODE3_PIP_HEIGHT;
Expand Down Expand Up @@ -561,9 +561,9 @@ void ARDroneDriver::publish_video()
image_msg.is_bigendian = false;
image_msg.step = D2_STREAM_WIDTH*3;
image_msg.data.resize(D2_STREAM_WIDTH*D2_STREAM_HEIGHT*3);
if(!fullspeed_video) vp_os_mutex_lock(&video_lock);
if(!realtime_video) vp_os_mutex_lock(&video_lock);
std::copy(buffer, buffer+(D2_STREAM_WIDTH*D2_STREAM_HEIGHT*3), image_msg.data.begin());
if(!fullspeed_video) vp_os_mutex_unlock(&video_lock);
if(!realtime_video) vp_os_mutex_unlock(&video_lock);
// We only put the width and height in here.


Expand Down
10 changes: 5 additions & 5 deletions src/ardrone_sdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ long int current_navdata_id = 0;
ARDroneDriver* rosDriver;

int32_t looprate;
bool fullspeed_navdata;
bool fullspeed_video;
bool realtime_navdata;
bool realtime_video;

int32_t should_exit;

Expand Down Expand Up @@ -61,8 +61,8 @@ extern "C" {
}

ros::param::param("~looprate",looprate,50);
ros::param::param("~fullspeed_navdata",fullspeed_navdata,false);
ros::param::param("~fullspeed_video",fullspeed_video,false);
ros::param::param("~realtime_navdata",realtime_navdata,false);
ros::param::param("~realtime_video",realtime_video,false);

// SET SOME NON-STANDARD DEFAULT VALUES FOR THE DRIVER
// THESE CAN BE OVERWRITTEN BY ROS PARAMETERS (below)
Expand Down Expand Up @@ -230,7 +230,7 @@ extern "C" {
shared_navdata_receive_time = ros::Time::now();
shared_raw_navdata = (navdata_unpacked_t*)pnd;

if(fullspeed_navdata)
if(realtime_navdata)
{
rosDriver->PublishNavdataTypes(*shared_raw_navdata, shared_navdata_receive_time); //if we're publishing navdata at full speed, publish!
rosDriver->publish_navdata(*shared_raw_navdata, shared_navdata_receive_time);
Expand Down
4 changes: 2 additions & 2 deletions src/ardrone_sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ extern vp_os_mutex_t video_lock;
extern vp_os_mutex_t twist_lock;

extern int32_t looprate;
extern bool fullspeed_navdata;
extern bool fullspeed_video;
extern bool realtime_navdata;
extern bool realtime_video;

extern int32_t should_exit;

Expand Down
2 changes: 1 addition & 1 deletion src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern "C" C_RESULT export_stage_transform( void *cfg, vp_api_io_data_t *in, vp_
vp_os_mutex_lock(&video_lock);
memcpy(buffer, in->buffers[0], in->size);
current_frame_id++;
if(fullspeed_video)
if(realtime_video)
{
rosDriver->publish_video();
}
Expand Down

0 comments on commit c1bff20

Please sign in to comment.