-
Notifications
You must be signed in to change notification settings - Fork 154
added gazebo plugins for d435i's IMU #22
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
Open
m-tartari
wants to merge
5
commits into
pal-robotics:melodic-devel
Choose a base branch
from
m-tartari:melodic-devel
base: melodic-devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5837e73
added gazebo plugins for d435i's IMU
m-tartari 3184e93
[bugfix] removed confilct for unset imu topics
m-tartari a03bad7
Updated README.md
m-tartari 16e8331
5 distorsion param for plumb_bob model because aruco_detect wants them
torydebra 9fdfabd
add basic devcontainer
m-tartari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
include/realsense_gazebo_plugin/gazebo_ros_accel_sensor.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| /* Copyright [2015] [Alessandro Settimi] | ||
| * | ||
| * email: [email protected] | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License.*/ | ||
|
|
||
| #ifndef GAZEBO_ROS_IMU_SENSOR_H | ||
| #define GAZEBO_ROS_IMU_SENSOR_H | ||
|
|
||
| #include <gazebo/common/Plugin.hh> | ||
| #include <gazebo/common/UpdateInfo.hh> | ||
| #include <ignition/math/Vector3.hh> | ||
| #include <ignition/math/Pose3.hh> | ||
| #include <ros/ros.h> | ||
| #include <sensor_msgs/Imu.h> | ||
| #include <string> | ||
|
|
||
| namespace gazebo | ||
| { | ||
| namespace sensors | ||
| { | ||
| class ImuSensor; | ||
| } | ||
| /** | ||
| @anchor GazeboRosAccelSensor | ||
| \ref GazeboRosAccelSensor is a plugin to simulate an Acceleration sensor, the main differences from \ref GazeboRosIMU are: | ||
| - inheritance from SensorPlugin instead of ModelPlugin, | ||
| - measurements are given by gazebo ImuSensor instead of being computed by the ros plugin, | ||
| - gravity is included in inertial measurements. | ||
| */ | ||
| /** @brief Gazebo Ros accel sensor plugin. */ | ||
| class GazeboRosAccelSensor : public SensorPlugin | ||
| { | ||
| public: | ||
| /// \brief Constructor. | ||
| GazeboRosAccelSensor(); | ||
| /// \brief Destructor. | ||
| virtual ~GazeboRosAccelSensor(); | ||
| /// \brief Load the sensor. | ||
| /// \param sensor_ pointer to the sensor. | ||
| /// \param sdf_ pointer to the sdf config file. | ||
| virtual void Load(sensors::SensorPtr sensor_, sdf::ElementPtr sdf_); | ||
|
|
||
| protected: | ||
| /// \brief Update the sensor. | ||
| virtual void UpdateChild(const gazebo::common::UpdateInfo &/*_info*/); | ||
|
|
||
| private: | ||
| /// \brief Load the parameters from the sdf file. | ||
| bool LoadParameters(); | ||
| /// \brief Gaussian noise generator. | ||
| /// \param mu offset value. | ||
| /// \param sigma scaling value. | ||
| double GuassianKernel(double mu, double sigma); | ||
|
|
||
| /// \brief Ros NodeHandle pointer. | ||
| ros::NodeHandle* node; | ||
| /// \brief Ros Publisher for imu data. | ||
| ros::Publisher imu_data_publisher; | ||
| /// \brief Ros IMU message. | ||
| sensor_msgs::Imu imu_msg; | ||
|
|
||
| /// \brief last time on which the data was published. | ||
| common::Time last_time; | ||
| /// \brief Pointer to the update event connection. | ||
| gazebo::event::ConnectionPtr connection; | ||
| /// \brief Pointer to the sensor. | ||
| sensors::ImuSensor* sensor; | ||
| /// \brief Pointer to the sdf config file. | ||
| sdf::ElementPtr sdf; | ||
| /// \brief Orientation data from the sensor. | ||
| //ignition::math::Quaterniond orientation; | ||
| /// \brief Linear acceleration data from the sensor. | ||
| ignition::math::Vector3d accelerometer_data; | ||
| /// \brief Angular velocity data from the sensor. | ||
| //ignition::math::Vector3d gyroscope_data; | ||
|
|
||
| /// \brief Seed for the Gaussian noise generator. | ||
| unsigned int seed; | ||
|
|
||
| //loaded parameters | ||
| /// \brief The data is published on the topic named: /robot_namespace/topic_name. | ||
| std::string robot_namespace; | ||
| /// \brief The data is published on the topic named: /robot_namespace/topic_name. | ||
| std::string topic_name; | ||
| /// \brief Name of the link of the IMU. | ||
| std::string body_name; | ||
| /// \brief Sensor update rate. | ||
| double update_rate; | ||
| /// \brief Gaussian noise. | ||
| double gaussian_noise; | ||
| /// \brief Offset parameter, position part is unused. | ||
| ignition::math::Pose3d offset; | ||
| }; | ||
| } | ||
|
|
||
| #endif //GAZEBO_ROS_IMU_SENSOR_H |
107 changes: 107 additions & 0 deletions
107
include/realsense_gazebo_plugin/gazebo_ros_gyro_sensor.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| /* Copyright [2015] [Alessandro Settimi] | ||
| * | ||
| * email: [email protected] | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License.*/ | ||
|
|
||
| #ifndef GAZEBO_ROS_IMU_SENSOR_H | ||
| #define GAZEBO_ROS_IMU_SENSOR_H | ||
|
|
||
| #include <gazebo/common/Plugin.hh> | ||
| #include <gazebo/common/UpdateInfo.hh> | ||
| #include <ignition/math/Vector3.hh> | ||
| #include <ignition/math/Pose3.hh> | ||
| #include <ros/ros.h> | ||
| #include <sensor_msgs/Imu.h> | ||
| #include <string> | ||
|
|
||
| namespace gazebo | ||
| { | ||
| namespace sensors | ||
| { | ||
| class ImuSensor; | ||
| } | ||
| /** | ||
| @anchor GazeboRosgyroSensor | ||
| \ref GazeboRosgyroSensor is a plugin to simulate a gyroscope sensor, the main differences from \ref GazeboRosIMU are: | ||
| - inheritance from SensorPlugin instead of ModelPlugin, | ||
| - measurements are given by gazebo ImuSensor instead of being computed by the ros plugin, | ||
| - gravity is included in inertial measurements. | ||
| */ | ||
| /** @brief Gazebo Ros gyroscope sensor plugin. */ | ||
| class GazeboRosgyroSensor : public SensorPlugin | ||
| { | ||
| public: | ||
| /// \brief Constructor. | ||
| GazeboRosgyroSensor(); | ||
| /// \brief Destructor. | ||
| virtual ~GazeboRosgyroSensor(); | ||
| /// \brief Load the sensor. | ||
| /// \param sensor_ pointer to the sensor. | ||
| /// \param sdf_ pointer to the sdf config file. | ||
| virtual void Load(sensors::SensorPtr sensor_, sdf::ElementPtr sdf_); | ||
|
|
||
| protected: | ||
| /// \brief Update the sensor. | ||
| virtual void UpdateChild(const gazebo::common::UpdateInfo &/*_info*/); | ||
|
|
||
| private: | ||
| /// \brief Load the parameters from the sdf file. | ||
| bool LoadParameters(); | ||
| /// \brief Gaussian noise generator. | ||
| /// \param mu offset value. | ||
| /// \param sigma scaling value. | ||
| double GuassianKernel(double mu, double sigma); | ||
|
|
||
| /// \brief Ros NodeHandle pointer. | ||
| ros::NodeHandle* node; | ||
| /// \brief Ros Publisher for imu data. | ||
| ros::Publisher imu_data_publisher; | ||
| /// \brief Ros IMU message. | ||
| sensor_msgs::Imu imu_msg; | ||
|
|
||
| /// \brief last time on which the data was published. | ||
| common::Time last_time; | ||
| /// \brief Pointer to the update event connection. | ||
| gazebo::event::ConnectionPtr connection; | ||
| /// \brief Pointer to the sensor. | ||
| sensors::ImuSensor* sensor; | ||
| /// \brief Pointer to the sdf config file. | ||
| sdf::ElementPtr sdf; | ||
| /// \brief Orientation data from the sensor. | ||
| //ignition::math::Quaterniond orientation; | ||
| /// \brief Linear acceleration data from the sensor. | ||
| //ignition::math::Vector3d accelerometer_data; | ||
| /// \brief Angular velocity data from the sensor. | ||
| ignition::math::Vector3d gyroscope_data; | ||
|
|
||
| /// \brief Seed for the Gaussian noise generator. | ||
| unsigned int seed; | ||
|
|
||
| //loaded parameters | ||
| /// \brief The data is published on the topic named: /robot_namespace/topic_name. | ||
| std::string robot_namespace; | ||
| /// \brief The data is published on the topic named: /robot_namespace/topic_name. | ||
| std::string topic_name; | ||
| /// \brief Name of the link of the IMU. | ||
| std::string body_name; | ||
| /// \brief Sensor update rate. | ||
| double update_rate; | ||
| /// \brief Gaussian noise. | ||
| double gaussian_noise; | ||
| /// \brief Offset parameter, position part is unused. | ||
| ignition::math::Pose3d offset; | ||
| }; | ||
| } | ||
|
|
||
| #endif //GAZEBO_ROS_IMU_SENSOR_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.