Skip to content
Snippets Groups Projects
Commit 2b36c5bc authored by Michael Jeronimo's avatar Michael Jeronimo Committed by Carl Delsey
Browse files

Fix build issues after rebasing

parent f15af215
No related branches found
No related tags found
No related merge requests found
Showing with 70 additions and 31 deletions
......@@ -159,6 +159,37 @@ protected:
void checkLaserReceived();
std::chrono::seconds laser_check_interval_; // TODO(mjeronimo): not initialized
// Pose hypothesis
typedef struct
{
double weight; // Total weight (weights sum to 1)
pf_vector_t pf_pose_mean; // Mean of pose esimate
pf_matrix_t pf_pose_cov; // Covariance of pose estimate
} amcl_hyp_t;
bool addNewScanner(
int & laser_index,
const sensor_msgs::msg::LaserScan::ConstSharedPtr & laser_scan,
const std::string & laser_scan_frame_id,
geometry_msgs::msg::PoseStamped & laser_pose);
bool shouldUpdateFilter(const pf_vector_t pose, pf_vector_t & delta);
bool updateFilter(
const int & laser_index,
const sensor_msgs::msg::LaserScan::ConstSharedPtr & laser_scan,
const pf_vector_t & pose);
void publishParticleCloud(const pf_sample_set_t * set);
bool getMaxWeightHyp(
std::vector<amcl_hyp_t> & hyps, amcl_hyp_t & max_weight_hyps,
int & max_weight_hyp);
void publishAmclPose(
const sensor_msgs::msg::LaserScan::ConstSharedPtr & laser_scan,
const std::vector<amcl_hyp_t> & hyps, const int & max_weight_hyp);
void calculateMaptoOdomTransform(
const sensor_msgs::msg::LaserScan::ConstSharedPtr & laser_scan,
const std::vector<amcl_hyp_t> & hyps,
const int & max_weight_hyp);
void sendMapToOdomTransform(const tf2::TimePoint & transform_expiration);
// Node parameters (initialized via initParameters)
void initParameters();
double alpha1_;
......
......@@ -80,7 +80,8 @@ dwb_controller:
sim_time: 1.7
linear_granularity: 0.05
xy_goal_tolerance: 0.25
critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
# critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
critics: ["RotateToGoal", "Oscillation", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
BaseObstacle.scale: 0.02
PathAlign.scale: 32.0
GoalAlign.scale: 24.0
......@@ -94,7 +95,7 @@ local_costmap:
robot_radius: 0.17
inflation_layer.cost_scaling_factor: 3.0
obstacle_layer:
enabled: True
enabled: False
always_send_full_costmap: True
observation_sources: scan
scan:
......@@ -103,12 +104,22 @@ local_costmap:
clearing: True
marking: True
local_costmap:
local_costmap_client:
ros__parameters:
use_sim_time: True
local_costmap:
local_costmap_rclcpp_node:
ros__parameters:
use_sim_time: True
global_costmap:
global_costmap:
ros__parameters:
robot_radius: 0.17
obstacle_layer:
enabled: True
enabled: False
always_send_full_costmap: True
observation_sources: scan
scan:
......@@ -117,13 +128,13 @@ global_costmap:
clearing: True
marking: True
local_costmap:
local_costmap_client:
global_costmap:
global_costmap_client:
ros__parameters:
use_sim_time: True
local_costmap:
local_costmap_rclcpp_node:
global_costmap:
global_costmap_rclcpp_node:
ros__parameters:
use_sim_time: True
......@@ -161,13 +172,3 @@ robot_state_publisher:
world_model:
ros__parameters:
use_sim_time: True
global_costmap:
global_costmap_client:
ros__parameters:
use_sim_time: True
global_costmap:
global_costmap_rclcpp_node:
ros__parameters:
use_sim_time: True
......@@ -59,7 +59,6 @@ NavigateToPoseBehaviorTree::NavigateToPoseBehaviorTree()
factory_.registerSimpleAction("clearEntirelyCostmapServiceRequest",
std::bind(&NavigateToPoseBehaviorTree::clearEntirelyCostmapServiceRequest, this,
std::placeholders::_1));
}
global_localization_client_ =
std::make_unique<nav2_util::GlobalLocalizationServiceClient>("bt_navigator");
......@@ -95,7 +94,6 @@ BT::NodeStatus NavigateToPoseBehaviorTree::clearEntirelyCostmapServiceRequest(
auto result = clear_entirely_costmap.invoke(request, std::chrono::seconds(3));
return BT::NodeStatus::SUCCESS;
} catch (std::runtime_error & e) {
RCLCPP_WARN(node_->get_logger(), e.what());
return BT::NodeStatus::FAILURE;
}
}
......
......@@ -25,7 +25,7 @@
using namespace std::chrono_literals;
namespace nav2_dwb_controller
namespace dwb_controller
{
DwbController::DwbController()
......@@ -142,7 +142,8 @@ DwbController::followPath(const std::shared_ptr<GoalHandle> goal_handle)
RCLCPP_DEBUG(get_logger(), "Providing path to the local planner");
planner_->setPlan(path);
ProgressChecker progress_checker(std::shared_ptr<rclcpp::Node>(this, [](auto) {}));
ProgressChecker progress_checker(rclcpp_node_);
rclcpp::Rate loop_rate(10);
while (rclcpp::ok()) {
nav_2d_msgs::msg::Pose2DStamped pose2d;
......@@ -227,4 +228,4 @@ bool DwbController::getRobotPose(nav_2d_msgs::msg::Pose2DStamped & pose2d)
return true;
}
} // namespace nav2_dwb_controller
} // namespace dwb_controller
......@@ -20,7 +20,7 @@
int main(int argc, char ** argv)
{
rclcpp::init(argc, argv);
auto node = std::make_shared<nav2_dwb_controller::DwbController>();
auto node = std::make_shared<dwb_controller::DwbController>();
rclcpp::spin(node->get_node_base_interface());
rclcpp::shutdown();
......
......@@ -91,8 +91,8 @@ DWBLocalPlanner::on_configure(const rclcpp_lifecycle::State & state)
traj_generator_ = traj_gen_loader_.createUniqueInstance(traj_generator_name);
goal_checker_ = goal_checker_loader_.createUniqueInstance(goal_checker_name);
traj_generator_->initialize(nh_);
goal_checker_->initialize(nh_);
traj_generator_->initialize(node_);
goal_checker_->initialize(node_);
loadCritics();
......@@ -538,7 +538,7 @@ DWBLocalPlanner::transformGlobalPlan(
// process it on the next iteration.
if (prune_plan_) {
global_plan_.poses.erase(begin(global_plan_.poses), transformation_begin);
pub_.publishGlobalPlan(global_plan_);
pub_->publishGlobalPlan(global_plan_);
}
if (transformed_plan.poses.size() == 0) {
......
......@@ -145,11 +145,12 @@ protected:
goal_handle->abort(result);
return;
case Status::RUNNING:
default:
loop_rate.sleep();
break;
}
loop_rate.sleep();
}
}
};
......
......@@ -65,7 +65,8 @@ void
NavigationDialog::timerEvent(QTimerEvent * event)
{
if (event->timerId() == timer_.timerId()) {
auto future_result = action_client_->async_get_result(goal_handle_);
auto future_result = goal_handle_->async_result();
if (rclcpp::spin_until_future_complete(client_node_, future_result, 1ms) ==
rclcpp::executor::FutureReturnCode::TIMEOUT)
{
......
......@@ -17,11 +17,12 @@
#include <string>
#include <memory>
#include "rclcpp/rclcpp.hpp"
#include "behaviortree_cpp/condition_node.h"
#include "nav2_robot/robot.hpp"
#include "geometry_msgs/msg/pose_with_covariance_stamped.hpp"
#include "nav2_tasks/compute_path_to_pose_task.hpp"
//#include "nav2_tasks/compute_path_to_pose_task.hpp"
namespace nav2_tasks
{
......@@ -56,13 +57,14 @@ public:
{
node_ = blackboard()->template get<rclcpp::Node::SharedPtr>("node");
node_->get_parameter_or<double>("goal_reached_tol", goal_reached_tol_, 0.25);
robot_ = std::make_unique<nav2_robot::Robot>(node_);
//robot_ = std::make_unique<nav2_robot::Robot>(node_);
initialized_ = true;
}
bool
goalReached()
{
#if 0
auto current_pose = std::make_shared<geometry_msgs::msg::PoseWithCovarianceStamped>();
if (!robot_->getCurrentPose(current_pose)) {
......@@ -79,6 +81,9 @@ public:
} else {
return false;
}
#else
return false;
#endif
}
private:
......
add_library(motions_lib SHARED
omni_motion_model.cpp
differential_motion_model.cpp
motion_model.cpp
)
target_link_libraries(motions_lib pf_lib)
......@@ -18,5 +18,5 @@ ament_target_dependencies(test_lifecycle_utils rclcpp_lifecycle)
target_link_libraries(test_lifecycle_utils ${library_name})
ament_add_gtest(test_actions test_actions.cpp)
ament_target_dependencies(test_actions rclcpp_action)
ament_target_dependencies(test_actions rclcpp_action test_msgs)
target_link_libraries(test_actions ${library_name})
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment