gavanderhoorn / fanuc_driver_exp

An alternative - experimental - Fanuc robot driver for ROS-Industrial
Apache License 2.0
29 stars 16 forks source link

Document how to handle external axes / groups #11

Closed VictorLamoine closed 6 years ago

VictorLamoine commented 6 years ago

Hello Gijs :)

It would be nice to document how to to handle extra axis or groups on Fanuc robots with this driver. At the moment I'm only interested in getting ROSSTATE working on a M710iC with a 2 axis turntable in group 2.

I've not yet dug the Karel code but maybe you already have examples with this kind of thing?

VictorLamoine commented 6 years ago

From what I understand in the code a linear track in the first group will be automatically supported.

I would like to be able to fetch joint states from two groups, the first group (6 axis of the robot) and the second group (2 axis turn table)

gavanderhoorn commented 6 years ago

Unfortunately this driver, similar to the regular fanuc_driver pkg, does not support multi-group motion at the moment. See ros-industrial/fanuc#9 for an overview issue.

The code you linked to earlier would be involved in multi-group support, but at the moment that is all there is.

Adding this is on the TODO list, but no work has been done in that direction (well, that's not entirely true: there has been some work done, but it's not in the public repositories). A complicating factor is that it would be nice to do make such support dynamic (ie: not hard-coded for a specific setup). That is non-trivial, especially when dealing with both synchronous and asynchronous motion across multiple groups.

An additional complication is that industrial_robot_client currently has no support for multi-group setups. Some of the code from motoman_driver would have to be ported, or fanuc_driver_exp would have to be migrated to industrial_robot_client v2 (the code that is not public already uses this).

Summarising:

gavanderhoorn commented 6 years ago

I'm not entirely sure it would be possible with your setup, but one way around this limitation is to change your robot's configuration and move the two additional axes to the first group.

This would most likely mean that all motion of the robot and turntable would become coordinated. Perhaps not something that you'd want.

gavanderhoorn commented 6 years ago

Just realised that you're mostly asking about ros_state. Adding multi-group state reporting is actually not that involved. I can see whether I can add that some time this week.

At least, it's not that involved on the fanuc_driver_exp side. The things I mentioned about industrial_robot_client and having to adapt that remain.

VictorLamoine commented 6 years ago

Thank you for the detailed responses. If you have some time to craft something it would really be helpful. I'll think about how I can simplify my application, it's 3D scanning with a Keyence mounted on a Fanuc robot. The positioner turns a part while the robot is fixed at that time, then the robot moves to another pose and the cycle goes on.

There are probably simplifications that would allow to do this without re-writing a lot of code!

gavanderhoorn commented 6 years ago

There is actually one relatively 'easy' way to get multi-group state reporting working: by using multiple fanuc_driver clients and two instances of ros_state on the controller.

That is how we've done it on ABB robots (such as YuMi fi) with the old driver (EGM will be different).

I'll see if I can quickly hack something together for you.

gavanderhoorn commented 6 years ago

See the grp2_hack branch (diff). (I've since deleted this branch).

I've basically just duplicated ROS_STATE, updated the MTION_GRP constant and made sure it ROS_STATE2 uses Server Tag 5 and TCP port 12002.

I'll attach an archive with the binaries once you tell me which version of system software you're running (V7.70 or V8.30).


Edit: an alternative hack I could put together is use a custom version of ROS_STATE that internally reads the joint states of both grp1 and grp2, but then combines the joint states such that axes 7 and 8 of the JOINT_POSITION msg are actually axes 1 and 2 of the second group.

On the ROS side you would just use a controller_joint_names parameter like so (or use other joint names, I just made something up):

controller_joint_names:
 - 'joint_1'
 - 'joint_2'
 - 'joint_3'
 - 'joint_4'
 - 'joint_5'
 - 'joint_6'
 - 'pjoint_1'
 - 'pjoint_2'

This is probably simpler, as you wouldn't need to run an additional robot_state instance and would not have to run joint_state_publisher to coalesce these msgs into a single JointState.

gavanderhoorn commented 6 years ago

See positioner_axes_as_78 (diff) for the second approach.

I think I like this better.

You'd only need to replace ROS_STATE, no duplication and the ROS side is also much simpler to configure (no second node, etc).

If you can let me know for which system software version you'd need a binary, I can attach it here to this thread.

gavanderhoorn commented 6 years ago

Seeing as it's only a single file, here are the binaries for the second approach (ie: positioner joints 1 and 2 in joint 7 and 8 of the 1st group):

Be sure to rename the files to ros_state.pc before copying to your controller.

I'm pretty sure this will work out-of-the-box.

Let me know.

VictorLamoine commented 6 years ago

Hey, I like the second option too! The drivers abstracts groups, which feels good because there is no such thing in ROS from what I know.

I'll begin testing this today and I'll report my progress. I will also provide you the information you asked !

gavanderhoorn commented 6 years ago

The drivers abstracts groups, which feels good because there is no such thing in ROS from what I know.

well .. motion groups do nicely map to ROS namespaces. Or at least, they can be made to map like that.

That makes it possible for drivers to relatively easily support asynchronous, but concurrent, execution of trajectories for different motion groups on the same controller.

So strictly speaking: no, there is no 'motion group' concept in ROS, but completely abstracting it away might also not be always desirable.

gavanderhoorn commented 6 years ago

(just deleted your duplicated comment)

VictorLamoine commented 6 years ago

Example package making use of the driver in the positioner_axes_as_78 branch: fanuc_m710ic_2_axis_turntable.zip

@gavanderhoorn should I add documentation somewhere or is this issue enough at the moment? Feel free to close :)

gavanderhoorn commented 6 years ago

As this is not really an 'officical' solution, let's keep this issue as a stand-in for documentation right now.

Future users looking for multi-group support will find it.

gavanderhoorn commented 6 years ago

Thanks again for testing.

Glad I was able to help.