Forum Comments

AR3 with ROS and MoveIt
In Robot Builds
Modify Teensy To Avoid Movement Break Limit Switch
In General Discussion
Dexter Ong
Feb 10, 2021
So I've also encountered this issue as well while writing my own calibration sequence and can add my findings to this discussion. I wasn't sure if it was due to a fault in my wiring but if others are facing it too, I figure it's worth sharing. I'm fairly certain that the spurious false readings are due to EMI noise from the motor cables. You can verify this by just reading the limit switches in a loop with the E-Stop on (24V to the motors disconnected), during which you should have clean LOW readings, and then reconnecting the 24V, after which you can observe the random HIGH readings. The reason why this hasn't been an issue with Chris's implementation of the calibration is the way the logic is handled. Not sure if it was intended or a nice coincidence. The motors are driven as long as the readings are LOW, instead of stopping permanently when a single HIGH reading is received. This allows the code to skip over the occasional HIGH readings and resume moving the joint on the next iteration of the loop. (There is still an edge case where all 6 limit switches are reporting false HIGH readings which would wrongly end the calibration, but I also have another theory in Point 3 for why this rarely happens as well). In KS's and my case, the code was driving the motors until a single HIGH reading was received and terminating thereafter, which exposed this issue. You can also expose this issue in Chris's calibration sequence by imposing a long delay if any of the switches are read as HIGH. The calibration sequence will immediately enter the delay. A strange observation I've made, though I may be mistaken on this, is that the false readings of the limit switches vary depending on which pins are being read. For example, just reading J3 limit switch in a loop will give consistent false readings, but when reading all 6 limit switches, there are false readings on some of the other switches but none on J3. This could be due to some capacitance in the teensy pins? Honestly I have no idea and haven't bothered to investigate further. What this does mean is that all 6 limit switches are unlikely to consistently give false readings simultaneously when being read at the same time, further helping to mask the issue. In conclusion, there is some EMI and other shenanigans going on, no idea if it's due to the limit switches, wiring, teensy or a combination of all of them. Short of re-wiring everything with shielded cables, adding a shunt capacitor to the limit switch signal line could perhaps help with the noise. Changing the limit switches to NC instead of NO would mask (not fix) the issue and allow actions to be triggered by the limit switch. For now though, I don't think it's a big issue functionally especially if the limit switches are only needed for calibration, so I haven't bothered to investigate further (in my case I now just read the pin consecutively a few times hah). It did make for an interesting puzzle.
0
0

Dexter Ong

More actions