Open imuguruza opened 8 years ago
I attached the files I showed you on Friday:
In the first one it is always something like this al time:
Enter command: CMD_SET_GOAL
Enter goal to set:180
Server reply :
cmd: 31
Enter command: CMD_GET_ERROR
Server reply :
cmd: 5, error: 1.254125
We can see the error in this case it seems to be aleatory between 1 and 11 but the servo is working properly.
In the second one nevertheless:
------------197--------------
Elapsed: 0.000109 seconds
recv failed: Bad file descriptor
recv failed: Bad file descriptor
Time: 9.085226 seconds
MAIN position value is: 581
MAIN pwm value is: -3
------------198--------------
Elapsed: 0.000105 seconds
recv failed: Bad file descriptor
Time: 9.096330 seconds
MAIN position value is: 3433
MAIN pwm value is: -14
------------199--------------
Elapsed: 0.000151 seconds
recv failed: Bad file descriptor
Time: 9.103085 seconds
MAIN position value is: 1065
MAIN pwm value is: -5
The position obtained with the adc changes quickly and the servo does not work properly. It is oscillating and some values are out of range like 3433 so the servo gears started to fail and the servo becomes useless.
First I thought that it was because the timer does not acting correctly but i did probes and is not.
Then I changed the PID values with Kp =1 and Kd =0 but it happened the same. I have to probe with Kp=2 if it works equal because there is a deadband value that i did not contemplate with Kp=1.
Then we talked about the PWM generation. Now is generating a PWM signal with a frequency of 2342.75Hz and in the oscilloscope it looks ok. There is a delayMicroseconds function used in the code from wiringPi library that maybe can delay this signal.
Also now I am using 12 bits for the adc and with 10 could be better? With the microcontroller (10 bits) it looked like it was more precise.
In the ADC I am using an 860SPS (samples per second). This ADC needs some time to do the conversion and get a value. I read that if there is a change in the channel that you are reading that also there is some time lost, but this seems weird.
I think you could explain it better, think that we have to understand what you're saying. Meaning that you're here the expert and that to help you we need more explanations about what you're talking about
If I'm not wrong youre using turnigy S901D servos. Note that the operating characterics says this:
Operating Speed: 0.16sec.60º -> 6v of Vcc/ 0.14sec.60º 7v of Vcc
So if you force to have a bigger degree movement, it could break or just do not respond
@jlamperez could you report please the set-point losses and errors you showed me last friday please? So we can read it and discuss possibles causes.
If you wish you could edit the name of this issue and writte it down here or create a new one.