ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Universal Robot Digital I/O

asked 2020-12-22 12:48:55 -0500

fruitbot gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-12-22 13:32:01 -0500

RobertWilbrandt gravatar image

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.

edit flag offensive delete link more

Comments

I am using the ur_robot_driver, so this is exactly what I need. Thank you.

fruitbot gravatar image fruitbot  ( 2020-12-22 13:48:26 -0500 )edit

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

Lokney gravatar image Lokney  ( 2021-04-07 01:39:36 -0500 )edit

@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 gravatar image gvdhoorn  ( 2021-04-07 02:19:58 -0500 )edit

@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.");
}
Lokney gravatar image Lokney  ( 2021-04-08 07:38:22 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-12-22 12:48:55 -0500

Seen: 1,656 times

Last updated: Dec 22 '20