Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "mbf_abstract_nav/robot_information.h"
#include <actionlib/server/action_server.h>
#include <forklift_interfaces/NavigateAction.h>
#include <tf2/LinearMath/Quaternion.h>

namespace mbf_abstract_nav{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <mbf_msgs/GetPathAction.h>
#include <forklift_interfaces/NavigateAction.h>
#include <mbf_msgs/RecoveryAction.h>
#include <tf2/LinearMath/Quaternion.h>

#include "mbf_abstract_nav/MoveBaseFlexConfig.h"
#include "mbf_abstract_nav/robot_information.h"
Expand Down
20 changes: 18 additions & 2 deletions mbf_abstract_nav/src/controller_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ void ControllerAction::start(
std::vector<geometry_msgs::PoseStamped> goal_path;
for(std::size_t it = 0; it<goal.path.checkpoints.size(); it++)
{
goal_path.push_back(goal.path.checkpoints[it].pose);
geometry_msgs::PoseStamped checkpoint_posestamped;
checkpoint_posestamped.header.frame_id = "map";
checkpoint_posestamped.pose.position.x = goal.path.checkpoints[it].pose.x;
checkpoint_posestamped.pose.position.y = goal.path.checkpoints[it].pose.y;
tf2::Quaternion q;
q.setRPY( 0, 0, goal.path.checkpoints[it].pose.theta );
q.normalize();
checkpoint_posestamped.pose.orientation = tf2::toMsg(q);
goal_path.push_back(checkpoint_posestamped);
}
execution_ptr->setNewPlan(goal_path);
// Update also goal pose, so the feedback remains consistent
Expand Down Expand Up @@ -130,7 +138,15 @@ void ControllerAction::run(GoalHandle &goal_handle, AbstractControllerExecution
std::vector<geometry_msgs::PoseStamped> goal_path;
for (int it = 0; it < goal.path.checkpoints.size(); it++)
{
goal_path.push_back(goal.path.checkpoints[it].pose);
geometry_msgs::PoseStamped checkpoint_posestamped;
checkpoint_posestamped.header.frame_id = "map";
checkpoint_posestamped.pose.position.x = goal.path.checkpoints[it].pose.x;
checkpoint_posestamped.pose.position.y = goal.path.checkpoints[it].pose.y;
tf2::Quaternion q;
q.setRPY( 0, 0, goal.path.checkpoints[it].pose.theta );
q.normalize();
checkpoint_posestamped.pose.orientation = tf2::toMsg(q);
goal_path.push_back(checkpoint_posestamped);
}

const std::vector<geometry_msgs::PoseStamped> &plan = goal_path;
Expand Down
16 changes: 14 additions & 2 deletions mbf_abstract_nav/src/move_base_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,13 @@ void MoveBaseAction::actionGetPathDone(
navigate_goal_.path.header = result.path.header; //TODO handle conversion from nav_msgs/Path to NavigatePath/Path
for(std::size_t it=0; it<result.path.poses.size(); it++)
{
navigate_goal_.path.checkpoints[it].pose = result.path.poses[it];
navigate_goal_.path.checkpoints[it].pose.x = result.path.poses[it].pose.position.x;
navigate_goal_.path.checkpoints[it].pose.y = result.path.poses[it].pose.position.y;
tf2::Quaternion qp(result.path.poses[it].pose.orientation.x, result.path.poses[it].pose.orientation.y, result.path.poses[it].pose.orientation.z, result.path.poses[it].pose.orientation.w);
tf2::Matrix3x3 mp(qp);
double roll, pitch, yaw;
mp.getRPY(roll, pitch, yaw);
navigate_goal_.path.checkpoints[it].pose.theta = yaw;
}
ROS_DEBUG_STREAM_NAMED("move_base", "Action \""
<< "move_base\" sends the path to \""
Expand Down Expand Up @@ -579,7 +585,13 @@ void MoveBaseAction::actionGetPathReplanningDone(
navigate_goal_.path.header = result->path.header; //TODO handle conversion from nav_msgs/Path to NavigatePath/Path
for(std::size_t it=0; it<result->path.poses.size(); it++)
{
navigate_goal_.path.checkpoints[it].pose = result->path.poses[it];
navigate_goal_.path.checkpoints[it].pose.x = result->path.poses[it].pose.position.x;
navigate_goal_.path.checkpoints[it].pose.y = result->path.poses[it].pose.position.y;
tf2::Quaternion qp(result->path.poses[it].pose.orientation.x, result->path.poses[it].pose.orientation.y, result->path.poses[it].pose.orientation.z,result->path.poses[it].pose.orientation.w);
tf2::Matrix3x3 mp(qp);
double roll, pitch, yaw;
mp.getRPY(roll, pitch, yaw);
navigate_goal_.path.checkpoints[it].pose.theta = yaw;
}
forklift_interfaces::NavigateGoal goal(navigate_goal_);
action_client_navigate_.sendGoal(
Expand Down