What does a ROS driver do vs. Python library for robot arm?
The main difference between a plain Python library and a ROS driver is: the former is a plain Python library, while the latter is a ROS driver (yes, that's a copy-paste).
A ROS driver is a ROS node that communicates "with hardware". To do this, it essentially has "two sides":
- a side that knows how to encode and decode data coming from the hardware device, and
- a side that offers a ROS API which other ROS nodes can use to talk to it (ie: topics, services and actions)
the real task of a driver is then to glue these two sides together and perform the translation between domain concepts the robot controller understands/works with and those in use in ROS.
A plain Python library does not do this. It will likely contain part 1, as otherwise it wouldn't be able to communicate with your robot controller. But part 2 is what makes a ROS driver a ROS driver, and it's very unlikely a random Python package comes with a ROS API (it's not a ROS node after all).
In your specific case: python-urx
is a Python package which allows remote control of UR robots, but it does not have a ROS API (so other ROS nodes cannot "talk" to it out-of-the-box). You could certainly use python-urx
to write a ROS driver (there probably are drivers for UR controllers which do this). But then you'd essentially use python-urx
for side 1, and would have to add side 2 yourself.
Why do you need the driver? It seems like everyone uses the driver, but why can't you just use the library?
The answer to this depends on what you want to do: if you'd like to use other ROS nodes to control your robot, using a driver might be much more convenient, as it will take care of transforming data coming from and going to the robot controller for you. It can execute trajectories for you -- coming from MoveIt for instance, but that's not a requirement -- and publishes data such as JointState
s, IO and other information in ROS message format. In addition it offers ROS services which you can invoke.
Couldn't you do this with the plain Python library? Of course. But it would mean having to implement all of this yourself.
So you could certainly "just use the library", it would just mean you'd be re-doing a lot of the work the developers of UniversalRobots/Universal_Robots_ROS_Driver
have already done.
Whether that makes it worthwhile to use the driver for you, we cannot say. That would be something only you can decide.
Please note: UniversalRobots/Universal_Robots_ROS_Driver is the location of the official UR ROS driver.
The repository you link to is a WIP to port that driver to ROS 2.
You're right, just edited my question!