Skip to content

Commit

Permalink
Reduce arguments to command processor
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahiminfinite committed Jun 26, 2023
1 parent a0af0a2 commit 7c66202
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class CommandProcessor
{
public:
CommandProcessor(const planning_scene_monitor::PlanningSceneMonitorPtr& planning_scene_monitor,
const moveit::core::JointModelGroup* joint_model_group, moveit::core::RobotStatePtr& current_state,
servo::Params& servo_params, StatusCode& servo_status);

/**
Expand Down Expand Up @@ -116,7 +115,7 @@ class CommandProcessor
size_t num_joints_;
const planning_scene_monitor::PlanningSceneMonitorPtr& planning_scene_monitor_;
const moveit::core::JointModelGroup* joint_model_group_;
moveit::core::RobotStatePtr& robot_state_;
moveit::core::RobotStatePtr robot_state_;
servo::Params& servo_params_;
StatusCode& servo_status_;

Expand Down
12 changes: 4 additions & 8 deletions moveit_ros/moveit_servo/src/command_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,11 @@ namespace moveit_servo
{

CommandProcessor::CommandProcessor(const planning_scene_monitor::PlanningSceneMonitorPtr& planning_scene_monitor,
const moveit::core::JointModelGroup* joint_model_group,
moveit::core::RobotStatePtr& current_state, servo::Params& servo_params,
StatusCode& servo_status)
: planning_scene_monitor_{ planning_scene_monitor }
, joint_model_group_{ joint_model_group }
, robot_state_{ current_state }
, servo_params_{ servo_params }
, servo_status_{ servo_status }
servo::Params& servo_params, StatusCode& servo_status)
: planning_scene_monitor_{ planning_scene_monitor }, servo_params_{ servo_params }, servo_status_{ servo_status }
{
robot_state_ = planning_scene_monitor_->getStateMonitor()->getCurrentState();
joint_model_group_ = robot_state_->getJointModelGroup(servo_params_.move_group_name);
num_joints_ = joint_model_group_->getActiveJointModelNames().size();
setIKSolver();
}
Expand Down
3 changes: 1 addition & 2 deletions moveit_ros/moveit_servo/src/servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ Servo::Servo(const rclcpp::Node::SharedPtr& node, std::shared_ptr<const servo::P
else
{
// Create the command processor to handle the different types of servo inputs.
command_processor_ = std::make_unique<CommandProcessor>(planning_scene_monitor_, joint_model_group_, robot_state_,
servo_params_, servo_status_);
command_processor_ = std::make_unique<CommandProcessor>(planning_scene_monitor_, servo_params_, servo_status_);

// Get necessary information about joints
joint_names_ = joint_model_group_->getActiveJointModelNames();
Expand Down

0 comments on commit 7c66202

Please sign in to comment.