Yaskawa-Global / motoros2

ROS 2 (rcl, rclc & micro-ROS) node for MotoPlus-compatible Yaskawa Motoman robot controllers
95 stars 16 forks source link

`JointState::velocity` values fluctuate, even when servos are off #17

Open gavanderhoorn opened 1 year ago

gavanderhoorn commented 1 year ago

Even when servos are off, values reported in JointState::velocity can fluctuate (as in: 'randomly' change).

This could be due to noise in the values reported by M+ APIs, or a conversion error on our end.

The fluctuations are relatively minor (ie: small fractional changes). In general the reported values appear to be OK.

ted-miller commented 1 year ago

To elaborate on this issue, it is not due to a conversion error in motoros2. I have witnessed this behavior on the teach pendant.

I'm not sure if it is due to the m-register-speed-feedback method that we're using, or something else.

If we see it happen again, we should look at the "Servo Monitor" screen on the pendant (not the M registers) to see what is being reported there.

BrunoB81HK commented 5 months ago

Hi,

I think I encountered a similar bug, but I'm not sure it is exactly the same.

For some reason, the velocities published on the /joint_state topic flickers, but a lot more than fractions. I have multiple joint velocities that are more than 600 rad/sec for a timeframe.

Currently, it is not causing any issues, but it could in the future.

Here is a screenshot of one of my log files. It represent the yaml format of a sensor_msgs/JointState:

speed_error

gavanderhoorn commented 5 months ago

Thanks for reporting.

Have you seen the values on the teach pendant as well? @ted-miller mentions something like that in his comment.

I have multiple joint velocities that are more than 600 rad/sec for a timeframe.

could you clarify what "for a timeframe" means exactly? Multiple samples, multiple seconds, multiple minutes? Something else?

The fact these values are almost identical also seems suspicious.

gavanderhoorn commented 5 months ago

@ted-miller: could this be due to modification concurrent with reading the M-registers? Seeing as we are concatenating two M-registers to get the full value, if they get modified while a read is in progress, strange things could happen.

ted-miller commented 5 months ago

I'm doubtful that it's a race condition with the mpReadIO function, but can't say with certainty.

I'd be interested to know if the values are shown on the teach pendant.

My first guess is that something else is writing to those same registers. Perhaps an external PLC or something in CIOPRG.LST.

ted-miller commented 5 months ago

Separate email from @BrunoB81HK:

We are currently connecting the robot controller to a PLC...

BrunoB81HK commented 5 months ago

could you clarify what "for a timeframe" means exactly?

By a timeframe, I mean the time between two messages published on the ´/joint_state´ topic. So if the frequency is 30 hz, the timeframe is ~33 ms.

BrunoB81HK commented 5 months ago

Separate email from @BrunoB81HK:

We are currently connecting the robot controller to a PLC...

Great catch, but this happened before we started connecting to a PLC.

I can try and get some data to help in the debugging. Let me know what you need and I'll do my best to provide it to you tomorrow.

BrunoB81HK commented 5 months ago

@gavanderhoorn @ted-miller Let me know if I can provide anything to help you find the problem.

ted-miller commented 5 months ago

@BrunoB81HK could you take a look at the teach pendant to see if the values are fluctuating on there? There are two places to look.

If you are using the Smart Pendant, please switch to the Classic Interface for this.


1) Navigate to IN / OUT > Register. Check the values of the following M-Registers to see if they are matching what is displaying on the joint_states.

image


2) Navigate to ROBOT > SERVO MONITOR. In the top DISPLAY menu, select MONITOR ITEM 1. Then select SPEED INST.

image

image


Lastly, could you please save a copy of the CIOPRG.LST (ladder program) from your pendant and post it here? I want to verify there aren't any other instructions writing to those registers.

BrunoB81HK commented 5 months ago

Hi @ted-miller,

I finally found some time to look into it. The Servo monitor was not fluctuating, but the registers were. Register M050 to M057 are fluctuating between 0 (0000_0000_0000_0000) and 6000 (0001_0111_0111_0000).


According to your image, those registers are linked to the speed of R1's Axis 1 to Axis 4. This makes sense since those are the only links that fluctuate. Here is the velocity component of a received JointState message :

[ 686.3018489302283, 686.3018512946209, 686.3018530768039, 686.3018490205695, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]

I looked up the user ladder program and found what looks like timers. Based on the line (TMR M050,6000), this is what is causing problem here. Let me know if you still need the CIOPRG.LST file.


The thing is, I don't think we modified the ladder for this controller, but I will talk to my colleagues to make sure. Do you know of any option that could need those timers?

Thanks a lot for your help!

gavanderhoorn commented 5 months ago

Nice find @BrunoB81HK.

That would indeed seem to explain how those 600-ish values end up in the velocity field.

ted-miller commented 5 months ago

@BrunoB81HK The simple fix would be to modify the parameters listed in section 3.12 of https://wiki.ros.org/motoman_driver/Troubleshooting#Not_receiving_axis_speeds_from_robot_controller This controls which registers get populated with the speed data. MotoROS2 will automatically detect this configuration and adjust accordingly.

Just change these parameters to use any other register numbers that aren't being used in the CIO ladder program.

BrunoB81HK commented 4 months ago

This solved the issue! Thanks a lot!