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 wrapper for the move by command. #103

Open
wants to merge 26 commits into
base: indigo-devel
Choose a base branch
from

Conversation

AndreasAZiegler
Copy link

Added wrapper for the move by command in the Parrot SDK. This command moves the drone to a relative position and rotate heading by a given angle.

Copy link
Member

@mani-monaj mani-monaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @AndreasAZiegler for this PR.

  1. Please see my inline comments.
  2. Please consider updating the documentation (in the docs folder) + add your information as a contributor to it.
  3. Please consider adding unit tests for these two functionalities (check bebop_driver/test folder and this part of the docs)

exit(gen.generate(PACKAGE, "bebop_driver_nodelet", "BebopArdrone3"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert back changes to this file.

@@ -870,6 +870,12 @@ class Ardrone3PilotingStateAltitudeChanged : public AbstractState

}; // Ardrone3PilotingStateAltitudeChanged

// Relative move ended.\n Informs about the move that the drone managed to do and why it stopped.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the following class to be part of this file? Unfortunately this file is auto-generated and will be overwritten by subsequent SDK updates.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, shouldn't be needed. I guess I was not enough careful while adding files.

exit(gen.generate(PACKAGE, "bebop_driver_nodelet", "Bebop{{project}}"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert back changes to this file.

@@ -549,6 +549,20 @@ void Bebop::Move(const double &roll, const double &pitch, const double &gaz_spee
}
}


void Bebop::MoveBy(const float& dX, const float& dY, const float& dZ, const float& dPsi)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change float to double in the signature since the twist message fields (that you pass here) are all doubles.

@@ -232,6 +235,23 @@ void BebopDriverNodelet::CmdVelCallback(const geometry_msgs::TwistConstPtr& twis
}
}

void BebopDriverNodelet::CmdMoveByCallback(const geometry_msgs::TwistConstPtr& twist_ptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please lint this function (indents, extra blank lines).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, if I understood your comment correctly. Pleas let me know, if it's the case.

{
try
{
ROS_INFO("Setting picture format to %f", format_ptr->data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think %f is correct here, since the input is of type uint8_t. Please fix.

try
{
ROS_INFO("Setting picture format to %f", format_ptr->data);
bebop_ptr_->SetPictureFormat(format_ptr->data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if format_ptr->data is not set to a value supported by SetPictureFormat? Please add a guard (or a warning) against this.

@@ -133,7 +133,7 @@ bool VideoDecoder::ReallocateBuffers()
boost::lexical_cast<std::string>(codec_ctx_ptr_->width) +
" x " + boost::lexical_cast<std::string>(codec_ctx_ptr_->width));

const uint32_t num_bytes = avpicture_get_size(PIX_FMT_RGB24, codec_ctx_ptr_->width, codec_ctx_ptr_->width);
const uint32_t num_bytes = avpicture_get_size(AV_PIX_FMT_RGB24, codec_ctx_ptr_->width, codec_ctx_ptr_->width);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current ffmpeg uses AV_PIX_FMT_RGB24. Older versions of ffmpeg provide PIX_FMT_RGB24.

@@ -143,12 +143,12 @@ bool VideoDecoder::ReallocateBuffers()
std::string("Can not allocate memory for the buffer: ") +
boost::lexical_cast<std::string>(num_bytes));
ThrowOnCondition(0 == avpicture_fill(
reinterpret_cast<AVPicture*>(frame_rgb_ptr_), frame_rgb_raw_ptr_, PIX_FMT_RGB24,
reinterpret_cast<AVPicture*>(frame_rgb_ptr_), frame_rgb_raw_ptr_, AV_PIX_FMT_RGB24,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

codec_ctx_ptr_->width, codec_ctx_ptr_->height),
"Failed to initialize the picture data structure.");

img_convert_ctx_ptr_ = sws_getContext(codec_ctx_ptr_->width, codec_ctx_ptr_->height, codec_ctx_ptr_->pix_fmt,
codec_ctx_ptr_->width, codec_ctx_ptr_->height, PIX_FMT_RGB24,
codec_ctx_ptr_->width, codec_ctx_ptr_->height, AV_PIX_FMT_RGB24,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

mani-monaj and others added 22 commits July 12, 2017 10:27
…movement. Adapted some values. All changes are related the piloting with move by command unit test.
@AndreasAZiegler
Copy link
Author

I applied your feedback and also added a unit test. As for the usage of the event "RELATIVE MOVE ENDED" arsdk version 3.12.6 is required, it would be good, if you can merge the PR "Add support for SDK 3.12.6 #120" before this one. I and then adapt the unit test accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants