Robot Game
v1.0
Research Track part 1 - Assignment
|
C++ Controller for a smallholonomic mobile robot. More...
#include "ros/ros.h"
#include "ros/console.h"
#include "geometry_msgs/PoseWithCovariance.h"
#include "geometry_msgs/Point.h"
#include "geometry_msgs/Vector3.h"
#include "geometry_msgs/Twist.h"
#include "nav_msgs/Odometry.h"
#include "robot_game/rg_get_target_srv.h"
#include "robot_game/rg_check_srv.h"
#include "robot_game/rg_get_vel_srv.h"
Go to the source code of this file.
Macros | |
#define | XMIN (-6.f) |
#define | XMAX (6.f) |
#define | YMIN (-6.f) |
#define | YMAX (6.f) |
Functions | |
geometry_msgs::Point | rg_get_new_target (ros::ServiceClient srv, double xmin, double xmax, double ymin, double ymax) |
require a new target to reach to the server. More... | |
void | rg_controller_task (const nav_msgs::Odometry::ConstPtr &posemsg) |
The main function of the controller. More... | |
int | main (int argc, char **argv) |
Ask for services, topics, and initialise the node. More... | |
Variables | |
ros::Subscriber | in |
ros::Publisher | out |
ros::ServiceClient | check_tg_srv |
ros::ServiceClient | newtg_srv |
ros::ServiceClient | get_vel_srv |
geometry_msgs::Point | target |
C++ Controller for a smallholonomic mobile robot.
This node implements a go-to-point behaviour using a very simple approach.
The controller listen to the topic 'base_pose_ground_truth'. When a new update about the posture comes, the controller generates a linear planar twist straight to the point, trying and approching to it.
When the target is "reached" (i.e. the robot is close enough to the target location), a new randomly generated target is required to a dedicated service.
Definition in file rg_controller.cpp.
#define XMAX (6.f) |
x max bound
Definition at line 39 of file rg_controller.cpp.
#define XMIN (-6.f) |
x min bound
Definition at line 36 of file rg_controller.cpp.
#define YMAX (6.f) |
y max bound
Definition at line 45 of file rg_controller.cpp.
#define YMIN (-6.f) |
y min bound
Definition at line 42 of file rg_controller.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
Ask for services, topics, and initialise the node.
Definition at line 133 of file rg_controller.cpp.
void rg_controller_task | ( | const nav_msgs::Odometry::ConstPtr & | posemsg | ) |
The main function of the controller.
posemsg | the actual posture received by the simulator |
This callback is called when a new position comes from the simulated environment via 'base_pose_ground_truth'.
It works in this way:
Definition at line 105 of file rg_controller.cpp.
geometry_msgs::Point rg_get_new_target | ( | ros::ServiceClient | srv, |
double | xmin, | ||
double | xmax, | ||
double | ymin, | ||
double | ymax | ||
) |
require a new target to reach to the server.
srv | the service |
xmin | x min bound |
xmax | x max bound |
ymin | y min bound |
ymax | y max bound |
Definition at line 73 of file rg_controller.cpp.
ros::ServiceClient check_tg_srv |
Definition at line 53 of file rg_controller.cpp.
ros::ServiceClient get_vel_srv |
Definition at line 55 of file rg_controller.cpp.
ros::Subscriber in |
subscription to base_pose_ground_truth (nav_msgs/Odometry)
Definition at line 48 of file rg_controller.cpp.
ros::ServiceClient newtg_srv |
Definition at line 54 of file rg_controller.cpp.
ros::Publisher out |
publisher to cmd_vel (geometry_msgs/Twist)
Definition at line 51 of file rg_controller.cpp.
geometry_msgs::Point target |
the actual target
Definition at line 58 of file rg_controller.cpp.