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
RobotOperator::mPlanPublisher
ros::Publisher mPlanPublisher
Definition: RobotOperator.h:111
RobotOperator::mTrajTable
sensor_msgs::PointCloud * mTrajTable[(LUT_RESOLUTION *4)+2]
Definition: RobotOperator.h:120
RobotOperator::mCurrentVelocity
double mCurrentVelocity
Definition: RobotOperator.h:116
ros::Publisher
RobotOperator::mLocalMap
costmap_2d::Costmap2DROS * mLocalMap
Definition: RobotOperator.h:100
RobotOperator::getPointCloud
sensor_msgs::PointCloud * getPointCloud(double direction, double velocity)
Get the trajectory defined by the given movement command.
Definition: RobotOperator.cpp:509
RobotOperator::mCostmap
costmap_2d::Costmap2D * mCostmap
Definition: RobotOperator.h:101
ros.h
RobotOperator::mContinueWeight
int mContinueWeight
Definition: RobotOperator.h:129
RobotOperator::RobotOperator
RobotOperator()
Definition: RobotOperator.cpp:8
costmap_2d::Costmap2D
RobotOperator::evaluateAction
double evaluateAction(double direction, double velocity, bool debug=false)
Calculate the action value of a given command.
Definition: RobotOperator.cpp:388
costmap_2d_ros.h
RobotOperator::mDriveMode
int mDriveMode
Definition: RobotOperator.h:118
RobotOperator::mConformanceWeight
int mConformanceWeight
Definition: RobotOperator.h:128
RobotOperator
Definition: RobotOperator.h:32
RobotOperator::mDesiredVelocity
double mDesiredVelocity
Definition: RobotOperator.h:114
RobotOperator::mTf2Buffer
tf2_ros::Buffer mTf2Buffer
Definition: RobotOperator.h:105
tf2_ros::TransformListener
RobotOperator::initTrajTable
void initTrajTable()
Initializes look-up tables This calculates the trajectories of all possible direction commands....
Definition: RobotOperator.cpp:65
RobotOperator::calculateFreeSpace
int calculateFreeSpace(sensor_msgs::PointCloud *cloud)
Calculates the distance the robot can move following the given trajectory.
Definition: RobotOperator.cpp:364
RobotOperator::mTfListener
tf::TransformListener mTfListener
Definition: RobotOperator.h:104
RobotOperator::receiveCommand
void receiveCommand(const nav2d_operator::cmd::ConstPtr &msg)
Callback function to receive move commands.
Definition: RobotOperator.cpp:182
LUT_RESOLUTION
#define LUT_RESOLUTION
Definition: RobotOperator.h:9
tf2_ros::Buffer
RobotOperator::mSafetyDecay
double mSafetyDecay
Definition: RobotOperator.h:126
RobotOperator::findBestDirection
double findBestDirection()
Evaluates all possible directions with a fixed resolution.
Definition: RobotOperator.cpp:489
RobotOperator::mRecoverySteps
unsigned int mRecoverySteps
Definition: RobotOperator.h:135
RobotOperator::mTf2Listener
tf2_ros::TransformListener mTf2Listener
Definition: RobotOperator.h:106
transform_listener.h
RobotOperator::mSafetyWeight
int mSafetyWeight
Definition: RobotOperator.h:127
RobotOperator::mTrajectoryPublisher
ros::Publisher mTrajectoryPublisher
Definition: RobotOperator.h:110
RobotOperator::mCommandSubscriber
ros::Subscriber mCommandSubscriber
Definition: RobotOperator.h:108
RobotOperator::mEscapeWeight
int mEscapeWeight
Definition: RobotOperator.h:130
RobotOperator::mMaxFreeSpace
double mMaxFreeSpace
Definition: RobotOperator.h:125
RobotOperator::mRobotFrame
std::string mRobotFrame
Definition: RobotOperator.h:133
RobotOperator::mControlPublisher
ros::Publisher mControlPublisher
Definition: RobotOperator.h:109
RobotOperator::mMaxVelocity
double mMaxVelocity
Definition: RobotOperator.h:122
RobotOperator::executeCommand
void executeCommand()
Generates and sends Twist-Message to Robot This is the Operator's core function and should be called ...
Definition: RobotOperator.cpp:200
tf::TransformListener
RobotOperator::mCostPublisher
ros::Publisher mCostPublisher
Definition: RobotOperator.h:112
RobotOperator::~RobotOperator
~RobotOperator()
Definition: RobotOperator.cpp:57
RobotOperator::mPublishRoute
bool mPublishRoute
Definition: RobotOperator.h:124
costmap_2d::Costmap2DROS
ros::Subscriber
RobotOperator::mDesiredDirection
double mDesiredDirection
Definition: RobotOperator.h:115
RobotOperator::mCurrentDirection
double mCurrentDirection
Definition: RobotOperator.h:117
RobotOperator::mOdometryFrame
std::string mOdometryFrame
Definition: RobotOperator.h:132
RobotOperator::mRasterSize
double mRasterSize
Definition: RobotOperator.h:102


nav2d_operator
Author(s): Sebastian Kasperski
autogenerated on Wed Mar 2 2022 00:37:35