Using Universal Robot instead of Pandas Arm in MoveIt2 tutorial
I`m using ros2 humble. I also installed the ROS2 Universal Robot Driver.
I can start the connection to the UR
ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur3e robot_ip:=192.168.1.102 launch_rviz:=false initial_joint_controller:=joint_trajectory_controller
and in a second Terminal:
ros2 launch ur_moveit_config ur_moveit.launch.py ur_type:=ur3e launch_rviz:=true
then i can plan and execute the path to a desired position and the robot moves. Now i want to move the Robot with my own script. Therefore i was working on a tutorial. Now I got the moveit2 tutorial running.
So far i have the problem, that i don't know what i need to change to get the UR running instead of the pandas arm? I'm not sure which packages or header i have to include or launch files i have to change etc. .
Can anyone give me an advice on how to get started on this? Or does anyone have a different approach to move the UR with my own written package and inverse kinematics?
Update:
I created a new package hello_moveit_ur
like in the tutorial explained.
Then i modified the sourcecode:
#include <memory>
#include <rclcpp/rclcpp.hpp>
#include <moveit/move_group_interface/move_group_interface.h>
int main(int argc, char * argv[])
{
// Initialize ROS and create the Node
rclcpp::init(argc, argv);
auto const node = std::make_shared<rclcpp::Node>(
"hello_moveit",
rclcpp::NodeOptions().automatically_declare_parameters_from_overrides(true)
);
// Create a ROS logger
auto const logger = rclcpp::get_logger("hello_moveit");
// Create the MoveIt MoveGroup Interface
using moveit::planning_interface::MoveGroupInterface;
auto move_group_interface = MoveGroupInterface(node, "ur_manipulator"); //CHANGE
// Set a target Pose
auto const target_pose = []{
geometry_msgs::msg::Pose msg;
msg.orientation.w = 1.0;
msg.position.x = 0.28;
msg.position.y = -0.2;
msg.position.z = 0.5;
return msg;
}();
move_group_interface.setPoseTarget(target_pose);
// Create a plan to that target pose
auto const [success, plan] = [&move_group_interface]{
moveit::planning_interface::MoveGroupInterface::Plan msg;
auto const ok = static_cast<bool>(move_group_interface.plan(msg));
return std::make_pair(ok, msg);
}();
// Execute the plan
if(success) {
move_group_interface.execute(plan);
} else {
RCLCPP_ERROR(logger, "Planing failed!");
}
// Shutdown ROS
rclcpp::shutdown();
return 0;
}
There i changed the MoveGroupInterface to "ur_manipulator"
.
Also in the package.xml
i added <depend>ros_ur_dirver</depend>
.
After building and sourcing i start the simulation
docker run --rm -it -p 5900:5900 -p 6080:6080 -v ${HOME}/.ursim/urcaps:/urcaps -v ${HOME}/.ursim/programs:/ursim/programs --name ursim universalrobots/ursim_e-series
then the ur driver
ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur3e robot_ip:=172.17.0.2 launch_rviz:=false initial_joint_controller:=joint_trajectory_controller
then the external control file in the simulation. Then ur moveit config
ros2 launch ur_moveit_config ur_moveit.launch.py ur_type:=ur3e launch_rviz:=true
then my new package
ros2 run hello_moveit_ur hello_moveit_ur
and the Terminal returns:
ros2 run hello_moveit_ur hello_moveit_ur
[ERROR] [1666102107.906278553] [hello_moveit]: Could not find parameter robot_description_semantic and did not receive robot_description_semantic via std_msgs::msg::String subscription within 10.000000 seconds.
Error: Could not parse the SRDF XML File. Error=XML_ERROR_EMPTY_DOCUMENT ErrorID=13 (0xd) Line number=0
at line 715 in /home/luca/ws_moveit2/src/srdfdom/src/model.cpp
[ERROR] [1666102107.910497801] [moveit_rdf_loader.rdf_loader ...