My team recently built a new robot and we are working on programming it. I use the PID that is included in robotC under the motor and sensor setup along with an Integrated motor encoder. It is a 4 motor single flywheel, and we are using the slave motor function to set all the motors to the same speed as the one with the IME and has PID control enabled. The issue is that it is setting the one PID motor to the desired 60 or so motor power, and the other three motors (one is Y cabled, so it is really only setting two in the code) to a motor power of 127. I am very confused as to why it is doing this, and if anyone could help i would really appreciate it. The code at the moment is very simple, and i cannot see where i am going wrong for the life of me.
here is the code that controls my flywheel. Its pretty simple and there is not much to it…
I have very similar issue, somebody said in the other threads that IME may not be responding that is why it is sending full power 127. I have basically switched off Cortex, removed the battery and let it sit for couple of seconds then plugged it back in and restarted then all worked fine. I know this is not the right solution, but gives you a temporary fix. I am also looking for the actual root cause and permanent fix.
I tested the code and it was working for me. Make sure you have everything wired correctly, no swaps on the two wire cables, red-red etc. If wiring is reversed all bets are off as the PID control expects that positive control values will make the motor encoder count forwards. Perhaps turn off the PID (you can leave on the slave control), send manual control to the motor and make sure (in the motors debug window) that the encoder is counting up with positive control values.
Glad you figured it out. The software has to make certain assumptions, it has no way to know how the motors are wired (I guess it could run a test on power up) and must assume that they are not reversed by swapping the wires around. If the motor is reversed by checking the box in motors & sensors setup that will be compensated for.