4 #include <boost/bind.hpp> 5 #include <sensor_msgs/JointState.h> 8 #if GAZEBO_MAJOR_VERSION >= 9 10 #include <ignition/math/Vector3.hh> 11 #include <ignition/math/Quaternion.hh> 13 #include <gazebo/math/gzmath.hh> 56 ROS_FATAL_STREAM(
"A ROS node for Gazebo has not been initialized, unable to load plugin. " 57 <<
"Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)");
62 std::string model_name = sdf->GetParent()->Get<std::string>(
"name");
63 gzdbg <<
"Plugin model name: " << model_name <<
"\n";
65 world_ = parent->GetWorld();
88 #if GAZEBO_MAJOR_VERSION >= 9 110 common::Time time_now;
111 #if GAZEBO_MAJOR_VERSION >= 9 112 time_now =
world_->SimTime();
114 time_now =
world_->GetSimTime();
118 prev_update_time_ = time_now;
144 else if ((msg->state == kobuki_msgs::MotorPower::OFF) && (
motors_enabled_))
153 #if GAZEBO_MAJOR_VERSION >= 9 bool cliff_detected_right_
Cliff flag for the right sensor.
double odom_pose_[3]
Vector for pose.
void propagateVelocityCommands()
GazeboRosPtr gazebo_ros_
pointer to the gazebo ros node
double wheel_sep_
Separation between the wheels.
bool shutdown_requested_
extra thread for triggering ROS callbacks
ROSCPP_DECL bool isInitialized()
bool prepareWheelAndTorque()
void Load(physics::ModelPtr parent, sdf::ElementPtr sdf)
Called when plugin is loaded.
bool cliff_detected_left_
Cliff flag for the left sensor.
bool prepareCliffSensor()
GazeboRosKobuki()
Constructor.
void OnUpdate()
Called by the world update start event.
common::Time last_cmd_vel_time_
Simulation time of the last velocity command (used for time out)
bool prepareVelocityCommand()
void setupRosApi(std::string &model_name)
bool motors_enabled_
Flag indicating if the motors are turned on or not.
#define ROS_FATAL_STREAM(args)
physics::ModelPtr model_
pointer to the model
double wheel_speed_cmd_[2]
Speeds of the wheels.
void motorPowerCB(const kobuki_msgs::MotorPowerPtr &msg)
Callback for incoming velocity commands.
void spin()
Spin method for the spinner thread.
void resetOdomCB(const std_msgs::EmptyConstPtr &msg)
Callback for resetting the odometry data.
#define ROS_INFO_STREAM(args)
bool cliff_detected_center_
Cliff flag for the center sensor.
GZ_REGISTER_MODEL_PLUGIN(GazeboRosP3D)
void cmdVelCB(const geometry_msgs::TwistConstPtr &msg)
Callback for incoming velocity commands.
#define ROS_ERROR_STREAM(args)
std::string node_name_
node name
ROSCPP_DECL void spinOnce()
void updateOdometry(common::Time &step_time)
common::Time prev_update_time_
Simulation time on previous update.
physics::WorldPtr world_
pointer to simulated world
~GazeboRosKobuki()
Destructor.
boost::shared_ptr< GazeboRos > GazeboRosPtr
event::ConnectionPtr update_connection_
pointer to the update event connection (triggers the OnUpdate callback when event update event is rec...