RobotOperator.h
Go to the documentation of this file.
1 #ifndef OPERATOR_H
2 #define OPERATOR_H
3 
4 #define NODE_NAME "operator"
5 #define COMMAND_TOPIC "cmd"
6 #define CONTROL_TOPIC "cmd_vel"
7 #define ROUTE_TOPIC "route"
8 #define PLAN_TOPIC "desired"
9 #define LUT_RESOLUTION 100
10 
11 #include <ros/ros.h>
13 #include <sensor_msgs/PointCloud.h>
14 #include <nav2d_operator/cmd.h>
15 #include <tf/transform_listener.h>
17 
18 #include <string>
19 
33 {
34 public:
35  // Default Constructor & Destructor
36  RobotOperator();
38 
39  // Public Methods
47  void receiveCommand(const nav2d_operator::cmd::ConstPtr& msg);
48 
53  void executeCommand();
54 
55 private:
56  // Internal Methods
62  int calculateFreeSpace(sensor_msgs::PointCloud* cloud);
63 
76  double evaluateAction(double direction, double velocity, bool debug = false);
77 
82  double findBestDirection();
83 
89  void initTrajTable();
90 
97  inline sensor_msgs::PointCloud* getPointCloud(double direction, double velocity);
98 
99  // Internal Storage
102  double mRasterSize;
103 
107 
113 
119 
120  sensor_msgs::PointCloud* mTrajTable[(LUT_RESOLUTION * 4) + 2];
121 
122  double mMaxVelocity;
123 
126  double mSafetyDecay;
131 
132  std::string mOdometryFrame;
133  std::string mRobotFrame;
134 
135  unsigned int mRecoverySteps;
136 };
137 
138 #endif
double mDesiredVelocity
ros::Publisher mPlanPublisher
void executeCommand()
Generates and sends Twist-Message to Robot This is the Operator&#39;s core function and should be called ...
ros::Publisher mCostPublisher
tf2_ros::TransformListener mTf2Listener
ros::Subscriber mCommandSubscriber
void initTrajTable()
Initializes look-up tables This calculates the trajectories of all possible direction commands...
sensor_msgs::PointCloud * getPointCloud(double direction, double velocity)
Get the trajectory defined by the given movement command.
double mMaxVelocity
double evaluateAction(double direction, double velocity, bool debug=false)
Calculate the action value of a given command.
double mDesiredDirection
costmap_2d::Costmap2D * mCostmap
ros::Publisher mTrajectoryPublisher
int calculateFreeSpace(sensor_msgs::PointCloud *cloud)
Calculates the distance the robot can move following the given trajectory.
void receiveCommand(const nav2d_operator::cmd::ConstPtr &msg)
Callback function to receive move commands.
double mSafetyDecay
#define LUT_RESOLUTION
Definition: RobotOperator.h:9
costmap_2d::Costmap2DROS * mLocalMap
double mCurrentVelocity
ros::Publisher mControlPublisher
tf2_ros::Buffer mTf2Buffer
double mCurrentDirection
std::string mOdometryFrame
double mMaxFreeSpace
std::string mRobotFrame
double findBestDirection()
Evaluates all possible directions with a fixed resolution.
tf::TransformListener mTfListener
double mRasterSize
unsigned int mRecoverySteps
sensor_msgs::PointCloud * mTrajTable[(LUT_RESOLUTION *4)+2]


nav2d_operator
Author(s): Sebastian Kasperski
autogenerated on Mon Feb 28 2022 22:56:59