stdr_robot.h
Go to the documentation of this file.
1 /******************************************************************************
2  STDR Simulator - Simple Two DImensional Robot Simulator
3  Copyright (C) 2013 STDR Simulator
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 3 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 
16  Authors :
17  * Manos Tsardoulias, etsardou@gmail.com
18  * Aris Thallas, aris.thallas@gmail.com
19  * Chris Zalidis, zalidis@gmail.com
20 ******************************************************************************/
21 
22 #ifndef ROBOT_H
23 #define ROBOT_H
24 
25 #include <ros/ros.h>
26 #include <nodelet/nodelet.h>
28 #include <stdr_msgs/RobotMsg.h>
29 #include <stdr_msgs/MoveRobot.h>
34 #include <stdr_robot/sensors/co2.h>
40 #include <nav_msgs/OccupancyGrid.h>
41 #include <nav_msgs/Odometry.h>
43 #include <stdr_msgs/RegisterRobotAction.h>
44 
49 namespace stdr_robot {
50 
54 
59  class Robot : public nodelet::Nodelet {
60 
61  public:
62 
67  Robot(void);
68 
73  void onInit(void);
74 
82  const stdr_msgs::RegisterRobotResultConstPtr result);
83 
89  void mapCallback(const nav_msgs::OccupancyGridConstPtr& msg);
90 
97  bool moveRobotCallback(stdr_msgs::MoveRobot::Request& req,
98  stdr_msgs::MoveRobot::Response& res);
99 
104  ~Robot(void);
105 
106  private:
107 
112  bool collisionExists(
113  const geometry_msgs::Pose2D& newPose,
114  const geometry_msgs::Pose2D& collisionPoint);
115 
117  const geometry_msgs::Pose2D& newPose);
118 
124  bool checkUnknownOccupancy(const geometry_msgs::Pose2D& newPose);
125 
130  void publishTransforms(const ros::TimerEvent&);
131 
132 
133  private:
134 
137 
140 
143 
146 
148  nav_msgs::OccupancyGrid _map;
149 
152 
155 
157  geometry_msgs::Pose2D _currentPose;
158 
160  geometry_msgs::Pose2D _previousPose;
161 
164 
166  RegisterRobotClientPtr _registerClientPtr;
167 
169  std::vector<std::pair<float,float> > _footprint;
170 
171  std::vector<std::pair<int,int> > getPointsBetween(
172  int x1, int y1, int x2, int y2) ;
173 
176 
179  };
180 
181 } // namespace stdr_robot
182 
183 
184 #endif
geometry_msgs::Pose2D _currentPose
Holds robots previous pose.
Definition: stdr_robot.h:157
Represents one robot in STDR. Inherts publicly from nodelet::Nodelet.
Definition: stdr_robot.h:59
void initializeRobot(const actionlib::SimpleClientGoalState &state, const stdr_msgs::RegisterRobotResultConstPtr result)
Initializes the robot after on registering it to server.
Definition: stdr_robot.cpp:74
std::vector< SensorPtr > SensorPtrVector
Definition: sensor_base.h:142
The main namespace for STDR Robot.
Definition: exceptions.h:27
bool checkUnknownOccupancy(const geometry_msgs::Pose2D &newPose)
Checks the robot&#39;s reposition into unknown area.
Definition: stdr_robot.cpp:249
ros::ServiceServer _moveRobotService
Container for robot sensors.
Definition: stdr_robot.h:142
MotionControllerPtr _motionControllerPtr
Actionlib client for registering the robot.
Definition: stdr_robot.h:163
bool collisionExists(const geometry_msgs::Pose2D &newPose, const geometry_msgs::Pose2D &collisionPoint)
Checks the robot collision -2b changed-.
Definition: stdr_robot.cpp:301
~Robot(void)
Default destructor.
Definition: stdr_robot.cpp:470
void publishTransforms(const ros::TimerEvent &)
Publishes the tf transforms every with 10Hz.
Definition: stdr_robot.cpp:413
ros::Subscriber _mapSubscriber
< ROS subscriber for map
Definition: stdr_robot.h:136
bool collisionExistsNoPath(const geometry_msgs::Pose2D &newPose)
Checks the robot collision -2b changed-.
Definition: stdr_robot.cpp:215
tf::TransformBroadcaster _tfBroadcaster
Odometry Publisher.
Definition: stdr_robot.h:151
bool _previousMovementYAxis
Definition: stdr_robot.h:178
ros::Timer _tfTimer
ROS service server to move robot.
Definition: stdr_robot.h:139
void mapCallback(const nav_msgs::OccupancyGridConstPtr &msg)
Callback for getting the occupancy grid map.
Definition: stdr_robot.cpp:183
boost::shared_ptr< RegisterRobotClient > RegisterRobotClientPtr
Definition: stdr_robot.h:53
bool _previousMovementXAxis
Robot&#39;s previous movement direction in Y Axis.
Definition: stdr_robot.h:175
SensorPtrVector _sensors
The occupancy grid map.
Definition: stdr_robot.h:145
nav_msgs::OccupancyGrid _map
ROS tf transform broadcaster.
Definition: stdr_robot.h:148
geometry_msgs::Pose2D _previousPose
Pointer of a motion controller.
Definition: stdr_robot.h:160
RegisterRobotClientPtr _registerClientPtr
The robot footprint in points (row * 10000 + col)
Definition: stdr_robot.h:166
Robot(void)
Default constructor.
Definition: stdr_robot.cpp:34
actionlib::SimpleActionClient< stdr_msgs::RegisterRobotAction > RegisterRobotClient
Definition: stdr_robot.h:52
ros::Publisher _odomPublisher
Holds robots current pose.
Definition: stdr_robot.h:154
std::vector< std::pair< int, int > > getPointsBetween(int x1, int y1, int x2, int y2)
Robot&#39;s previous movement direction in X Axis.
Definition: stdr_robot.cpp:276
bool moveRobotCallback(stdr_msgs::MoveRobot::Request &req, stdr_msgs::MoveRobot::Response &res)
The callback of the re-place robot service.
Definition: stdr_robot.cpp:194
std::vector< std::pair< float, float > > _footprint
Definition: stdr_robot.h:169
void onInit(void)
Initializes the robot and gets the environment occupancy grid map.
Definition: stdr_robot.cpp:43


stdr_robot
Author(s): Manos Tsardoulias, Chris Zalidis, Aris Thallas
autogenerated on Mon Jun 10 2019 15:15:10