0
$\begingroup$

Rosanswers logo

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?


Originally posted by fruitbot on ROS Answers with karma: 19 on 2020-12-22

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by RobertWilbrandt with karma: 176 on 2020-12-22

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by fruitbot on 2020-12-22:
I am using the ur_robot_driver, so this is exactly what I need. Thank you.

Comment by Lokney on 2021-04-07:
Hi, do you know how to use it in C++? Everything what I found about it was in Python. I am using UR10 with ur_robot_driver

Comment by gvdhoorn on 2021-04-07:
@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.

Comment by Lokney on 2021-04-08:
@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.");
}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.