I had that question about the green wire. It's floating in my setup.I have experienced that same problem with a pressure transducer. My solution was total electrical isolation from the framework of the machine and completely separating the electrical wires as well. So the shield on the sensor wires was only grounded at the sensor input to the control system, and the sensor ground was only connected to ground at the sensor control system sensor input. In addition, the motor wires were also shielded, and that shield was grounded at the motor drive controller. In that situation it produced adequate isolation. The fix was tedious but not complicated or expensive. So it might possibly be that you will need to experiment with shielding the motor drive wires, and connecting it only to the motor drive package housing. That housing would then also be connected to the "green wire" safety ground.
Also, I just tried another sensor position and now the noise is not so frequent as before. So I think I need total isolation between the sensor and the motor.