Universal Robot Digital I/O
I am using a UR3e and would like to access the digital I/O peripherals on the control box.
Does anyone know how to do this?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
I am using a UR3e and would like to access the digital I/O peripherals on the control box.
Does anyone know how to do this?
Hey, which driver are you using to control the robot? If you are using the official ur_robot_driver, you should be able to control IO using the set_io
service. For more information about all the services provided see their ROS interface documentation.
The service uses the ur_msgs/SetIO message type. When trying this out, it might make sense to look at the output from the io_states
topic (type ur_msgs/IO), as the pin numbers should match.
Feel free to ask more if you have specific questions.
@Lokney: it's all standard ROS services, which work from C++ as well.
See Writing a Simple Service and Client (C++) for the basic client tutorial. Make sure to update the used service definitions.
And looking at io_states
is a good idea, but I'd recommend consulting the documentation in the service definition itself.
@gvdhoorn Thank you for quick answer and useful hints. Below I put part of code in case someone would look for it in future.
#include <ur_msgs/SetIO.h>
#include <ur_robot_driver/hardware_interface.h>
...
ros::ServiceClient io_client = node_handle.serviceClient<ur_msgs::SetIO>("/ur_hardware_interface/set_io");
ur_msgs::SetIO io_service;
io_service.request.fun = 1; // Specify what type of IO you want to control, 1 is digital output
io_service.request.pin = 0; // Pin number
io_service.request.state = 1; // State, as far as I know it can be also voltage
if (io_client.call(gripper_service))
{
ROS_INFO("Successfull D0 gripper IO states change.");
}
else
{
ROS_ERROR("Failed to change D0 gripper IO states.");
}
Asked: 2020-12-22 12:48:55 -0500
Seen: 1,656 times
Last updated: Dec 22 '20
alwaysOn camera parameter Gazebo
error while launching lslidar_c16
Trajectory Post Processing Methods
Melodic fresh install unmet dependencies
Invoking “make cmake_check_build_system” failed error in ROS
Lowest end computer that will run ROS and all its tools
ServiceServer declaration within a class