平时的官方教程的MoveGroupInterface大都是这样写的,直接在main函数里面
auto const node = std::make_shared<rclcpp::Node>(
"moveit_hello",
rclcpp::NodeOptions().automatically_declare_parameters_from_overrides(true));
......
using moveit::planning_interface::MoveGroupInterface;
auto move_group_interface = MoveGroupInterface(node, "panda_arm");
现在我想把他写在类里面使用,假如类是这样的
class TestMoveGroupInterface : public rclcpp::Node
{
public:
PointMap() : Node(
"hello_moveit",
rclcpp::NodeOptions().automatically_declare_parameters_from_overrides(true))
{
// Create the MoveIt MoveGroup Interface
// 这行代码报错
moeve_interface_= MoveGroupInterface(this, "panda_arm");
}
private:
moveit::planning_interface::MoveGroupInterface moeve_interface_;
};
但是这行代码不能这样写,不能用this关键字,这行代码报错
moeve_interface_= MoveGroupInterface(this, "panda_arm");
进到这个MoveGroupInterface函数具体查看是这样传参的
MoveGroupInterface(const rclcpp::Node::SharedPtr& node, const std::string& group,
const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>(),
const rclcpp::Duration& wait_for_servers = rclcpp::Duration::from_seconds(-1));
想问一下各位大佬怎么在类里面使用MoveGroupInterface