-
Notifications
You must be signed in to change notification settings - Fork 766
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
Add an IMU sensor plugin that inherits from SensorPlugin #363
Add an IMU sensor plugin that inherits from SensorPlugin #363
Conversation
Has anyone had time to look at this? |
This looks good. Could you please add your overview (3 bullet points in PR description) on differences between gazebo_ros_imu and gazebo_ros_imu_sensor somewhere? I don't have a good place for it in mind (maybe here). I am looking into doxygen generation as well. |
… and GazeboRosIMU
I uptaded the documentation of the plugin and I also created this pull request in the tutorials documentation: https://bitbucket.org/osrf/gazebo_tutorials/pull-requests/335 |
The aforementioned pull request has been merged. |
This is present in tutorial but not merged: http://gazebosim.org/tutorials?tut=ros_gzplugins&cat=connect_ros#IMUsensor(GazeboRosImuSensor) |
@osrf-jenkins run test please |
void gazebo::GazeboRosImuSensor::Load(gazebo::sensors::SensorPtr sensor_, sdf::ElementPtr sdf_) | ||
{ | ||
sdf=sdf_; | ||
sensor=dynamic_cast<gazebo::sensors::ImuSensor*>(sensor_.get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check against null pointer after the dynamic_cast here. Maybe the plugin was loaded for a sensor which is not an ImuSensor
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the test you suggested.
Is there a reason why you took over the scalar +1 for providing an alternative ROS plugin for the broken |
Yeah. Just as fyi, the tutorial is confusing (2 IMU plugins. One is not existent yet ( |
I added a check on Gazebo version since some functions have changed since the version 6.0 |
I also changed some function that are now deprecated for gazebo version greater than 7.0. |
Yes, my thanks too for adding this sensor plugin. I agree, though: not clear why |
//NAMESPACE | ||
if (sdf->HasElement("robotNamespace")) | ||
{ | ||
robot_namespace = "/" + sdf->Get<std::string>("robotNamespace") +"/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not including the root '/' in the namespace ? As already used in the gazebo_ros_control plugin (see http://gazebosim.org/tutorials?tut=ros_control&cat=connect_ros)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 3b4735a
} | ||
|
||
//BODY NAME | ||
if (sdf->HasElement("bodyName")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"bodyName" is referenced as "frameName" in other plugins (see here), maybe better keeping the same convention ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 0cb04ca
@j-rivero think this can be merged? I'm not super familiar with IMU sensors. This PR also targets indigo, maybe it should just be targeted to Kinetic since the original PR is so old now? |
+1 for merging. This can only be better than what's currently available. Lets merge first to Indigo and then pull up to Kinetic. |
We would also find this plugin useful, +1 to merging. |
Thanks for the feedback. Before merging, it would be nice to include a test or at least an example world that includes the IMU so black box testing can be run without having to implement one. @iluetkeb we try to merge and release new additions or modifications first into Jade/Kinetic and threat Indigo as a more stable code where changes landed after a period of testing in the other distributions. |
Thanks very much @alessandrosettimi for the work and the rest of you for the comments. |
…ion#363) * added a IMU sensor plugin that inherits from SensorPlugin * now the plugin works with multiple robots * using GetParentName name instead of GetScopedName * added comments to highlight the differents between GazeboRosImuSensor and GazeboRosIMU * now the message header is properly handled, using bodyName parameter as frame_id * added check on gazebo version * added check for sensor null pointer * changed deprecated functions for gazebo version >= 6 * fixed version check * added missing sensor variable for LastUpdateTime() function call * considering '/' included in the robotNamespace * replaced "bodyFrame" with "frameName"
We added a new imu plugin: gazebo_ros_imu_sensor.
Main differences from gazebo_ros_imu: