7 namespace plugin_demo_interface_namespace
17 ROS_WARN(
"[interface] plugin was already initialized. Nothing will be done.");
21 pathPub = roshandle.advertise<nav_msgs::Path>(
"path", 10);
26 target.header.stamp = ros::Time::now();
45 ROS_INFO(
"[interface] plugIn has no onInit function");
50 pose3d->header.stamp = ros::Time::now();
51 pose3d->pose.position.x = x;
52 pose3d->pose.position.y = y;
53 pose3d->pose.position.z = 0;
54 pose3d->pose.orientation.x = 0;
55 pose3d->pose.orientation.y = 0;
56 pose3d->pose.orientation.z = sin(theta * 0.5);
57 pose3d->pose.orientation.w = cos(theta * 0.5);
62 setPose2d( &(this->start), start->x, start->y, start->theta);
63 setPose2d( &(this->target), target->x, target->y, target->theta);
78 start->x = this->start.pose.position.x;
79 start->y = this->start.pose.position.y;
82 target->x = this->target.pose.position.x;
83 target->y = this->target.pose.position.y;
92 tf::Quaternion q(quat.x, quat.y, quat.z, quat.w);
94 double roll, pitch, yaw;
95 m.getRPY(roll, pitch, yaw);
102 tf_tf->setOrigin( tf::Vector3(pose->pose.position.x, pose->pose.position.y, pose->pose.position.z) );
103 tf::Quaternion q(pose->pose.orientation.x, pose->pose.orientation.y, pose->pose.orientation.z, pose->pose.orientation.w);
104 tf_tf->setRotation(q);
138 tf_br.sendTransform(tf::StampedTransform(
start_tf, ros::Time::now(),
"world",
"start"));
139 tf_br.sendTransform(tf::StampedTransform(
target_tf, ros::Time::now(),
"world",
"target"));
ros::Timer sendPathTimer
periodic calling of the path publisher
void sendPathCallback(const ros::TimerEvent &event)
call sendPath()
void initialize(ros::NodeHandle roshandle)
Initalize the global variables.
int setPoints(geometry_msgs::Pose2D *start, geometry_msgs::Pose2D *target)
replace the current start and target poses and call getPath()
void getTargetCallback(const geometry_msgs::PoseStamped event)
receives a new target pose and call getPath().
ros::Publisher pathPub
send the path calculated by the plugIn
void getStarttCallback(const geometry_msgs::Pose2D event)
receives a new start pose and call getPath().
virtual int onInit(ros::NodeHandle roshandle)
In this function the plugIn can do some initialisation depending on a ROS NodeHandle.
double getYawFromQuat(geometry_msgs::Quaternion quat)
convert a quaternion into yaw
tf::TransformBroadcaster tf_br
send tf-transforms
void sendPath()
publish current_path and the start_tf and target_tf frames
void tfFrameFromPoseStamped(geometry_msgs::PoseStamped *pose, tf::Transform *tf_tf)
build a tf-frame for a given pose
int getPoints(geometry_msgs::Pose2D *start, geometry_msgs::Pose2D *target)
returns the current start and target poses
ros::Subscriber getStartSub
listen for a new start pose
PathPlanner()
initialize init
tf::Transform start_tf
the start tf-frame
geometry_msgs::PoseStamped target
last pose of the path
ros::Subscriber getTargetSub
listen for a new target pose
Contain the Interface class.
nav_msgs::Path current_path
contain the path
tf::Transform target_tf
the target tf-frame
virtual int getPath()=0
calculate current_path from start and target inside a plugIn.
void setPose2d(geometry_msgs::PoseStamped *pose3d, double x, double y, double theta)
convert a given 2D-Pose into 3D-Stamped-Pose.
bool init
true if initialized.
geometry_msgs::PoseStamped start
starting pose of the path