ur arm unable to construct robot model
hi all. im using ros2 foxy on ubuntu 20.04.
im tring to use the ur10e arm with moveit as explind in : https://github.com/UniversalRobots/Un....
first i launch the controllers and the ur_moveit.
ros2 launch ur_bringup ur_control.launch.py ur_type:=ur10e robot_ip:=yyy.yyy.yyy.yyy use_fake_hardware:=true launch_rviz:=false
ros2 launch ur_bringup ur_moveit.launch.py ur_type:=ur10e robot_ip:="xxx.xxx" use_fake_hardware:=true launch_rviz:=true
inside the rviz i can use MotionPlaninng intrface and its working parfectly. if i want to use the MoveGroupInterface and control the arm frue code i get the erorr:
[FATAL] [1662929960.551830751] [move_group_interface]: Unable to construct robot model. Please make sure all needed information is on the parameter server.
terminate called after throwing an instance of 'std::runtime_error'
what(): Unable to construct robot model. Please make sure all needed information is on the parameter server.
i run my node from ros2 run and not launch file.
my code:
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/planning_scene_interface/planning_scene_interface.h>
#include <moveit_msgs/msg/collision_object.hpp>
int main(int argc, char** argv) {
rclcpp::init(argc, argv);
rclcpp::NodeOptions node_options;
node_options.automatically_declare_parameters_from_overrides(true);
auto move_group_node = rclcpp::Node::make_shared("tr_plnner", node_options);
rclcpp::executors::SingleThreadedExecutor executor;
executor.add_node(move_group_node);
std::thread([&executor]() { executor.spin(); }).detach();
static const std::string PLANNING_GROUP = "ur_manipulator";
moveit::planning_interface::MoveGroupInterface move_group(move_group_node, PLANNING_GROUP);
moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
std::cout<<"0"<<std::endl;
rclcpp::shutdown();
return 0; }
my CMakeLists:
cmake_minimum_required(VERSION 3.5)
project(ur10e_trajectory_planner)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(moveit_ros_planning_interface REQUIRED)
find_package(rclcpp REQUIRED)
find_package(ur_client_library REQUIRED)
add_executable(tr_plnner src/test.cpp)
target_include_directories(tr_plnner PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
ament_target_dependencies(
tr_plnner
moveit_ros_planning_interface
rclcpp
)
target_link_libraries(tr_plnner ur_rtde::rtde)
install(TARGETS tr_plnner
DESTINATION lib/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
tanks for the help.