| View previous topic :: View next topic |
| Author |
Message |
guru
Joined: 03 Jan 2006 Posts: 128 Location: St Pete Beach, FL
|
Posted: Wed Jan 11, 2006 5:23 am Post subject: Documentation for the SuperServo (colinmackenzie.net) |
|
|
I have uploaded my current documentation as pdf's describing how my superservo works. You can download it at:
http://www.colinmackenzie.net/servo-docs.zip
I also uploaded the MPASM source code for the servo firmware to the openservo.com cvs site named 'superservo'. Use:
> cvs -d :pserver:anonymous@openservo.com:/OpenServo -login
> cvs -d :pserver:anonymous@openservo.com:/OpenServo checkout superservo
I have been writing a program called Servo Workbench, the windows host application which allows you to control servos via javascript. Hopefully, I can get a few of you involved in its development and enhance it. I could definately use some experienced DirectX programmers! It's using a proprietary gui library right now. It's pretty as hell, but if I could find a good free replacement library I could release the source.
I will post some screeshots soon.
C
Last edited by guru on Wed Jan 11, 2006 5:31 am; edited 1 time in total |
|
| Back to top |
|
 |
andylippitt Site Admin
Joined: 02 Jan 2006 Posts: 155 Location: Denver, CO
|
|
| Back to top |
|
 |
mikewardlow
Joined: 16 Mar 2006 Posts: 42
|
Posted: Thu Mar 16, 2006 10:11 pm Post subject: superservo 16bit |
|
|
I have tried assembling servo.asm with define 16 bit and getseveral errors
I can assemble without define 16bit with no problems....
is some code missing?????????
I have a rough working 12F683 pid8 version using RC pulse as input
and using a BIG [12volt] servo....the servo motion is quite good..
and I have just relized that I am not using CCP pin [pwm]
The servo is only being driven by CW and CCW and
motion is quite smooth....[I don't quite understand all this]  |
|
| Back to top |
|
 |
mpthompson
Joined: 02 Jan 2006 Posts: 650 Location: San Carlos, CA
|
Posted: Thu Mar 16, 2006 11:13 pm Post subject: |
|
|
Mike,
I'm not sure how often Colin (guru) swings by these forums to answer questions. If you haven't done so already you may want to also email him your question (use the button below his message) and you may get a more prompt answer.
I'm curious. Are you building your own SuperServos?
-Mike |
|
| Back to top |
|
 |
mikewardlow
Joined: 16 Mar 2006 Posts: 42
|
Posted: Fri Mar 17, 2006 1:04 am Post subject: superservo |
|
|
Well sort of.... I've been wanting to build a radio controlled lawn mower for years and have gotten my interest up this last year......
The first thing I needed was a steering servo....so
I got geared 24volt motor threading assembly from an STK tape transport
then directly attached a 5k pot to the shaft along with a 4.5 inch arm
I'm using 12f683 @8mhz and a very simple h-bridge with +12 volts....
I'm very satisfied with the motion....but this may all change with
higher voltage.....[will need more power]
I have a 13 meg video of servo, but have no way of editing / reducing
the size.....
the simple h-bridge contains 2-npn 2-pfet 2-nfet 6-resistors |
|
| Back to top |
|
 |
mpthompson
Joined: 02 Jan 2006 Posts: 650 Location: San Carlos, CA
|
Posted: Fri Mar 17, 2006 5:01 am Post subject: |
|
|
Sounds great. The SuperServo or the OpenServo should do a pretty good job of controlling such a servor once you have the H-bridge beefed up enough to handle the more powerful motor. However, if you are using a standard RC interface to the servo our circuits and software may not be of much use.
You may want to compare notes with Barry Carter in these forums. He's using a modified version of the OpenServo to control powerful motors in a robot arm he's building.
A link to his site is below:
http://www.headfuzz.co.uk/?q=robotarmtwo
-Mike |
|
| Back to top |
|
 |
mikewardlow
Joined: 16 Mar 2006 Posts: 42
|
Posted: Fri Mar 17, 2006 11:53 am Post subject: superservo |
|
|
I'm mainly interested in the PID part etc....
Striping out thr I2C code etc usually isn't a big chore...
Converting RC pulse is easy enough. Capture using 1us timer
subtract 1000, set bounds 0-1023, then you have a 10 bit value compatabile with 10bit dac...Then comes the squirly stuff [PID]
I sure would be nice if you put detailed flowcharts with the pid stuff..
I only use PIC's and assembly....I have a tough enough time programming these, without trying to learn more, heck it took me
3 weeks to get the configuration crap correct on the 18f1220 pic.. |
|
| Back to top |
|
 |
mpthompson
Joined: 02 Jan 2006 Posts: 650 Location: San Carlos, CA
|
Posted: Fri Mar 17, 2006 5:13 pm Post subject: |
|
|
Perhaps Colin can help you with the flow charts as he is leading efforts to create the SuperServo code for the PIC MCUs. Most of us on this forum are working with OpenServo which is similar to Colin's efforts to build an open source/hardware servo. The OpenServo was inspired Colin's early servo work, but is a different project. We are using AVR MCUs and the GNU GCC toolchain to develop the code in C. The hardware design is very similar to the SuperServo.
I'm pretty familiar with the PID algorithms and could perhaps help you there. However, I know nothing about PIC assembly, but perhaps other people on this forum are knowledgeable in that area.
I have a series of links that you can view on the page below regarding the PID algorithm and servos. I used this information while developing the OpenServo algorithms. Perhaps they may be of some use.
http://www.furl.net/members/mpthompson?search=browse&category=507872
-Mike |
|
| Back to top |
|
 |
guru
Joined: 03 Jan 2006 Posts: 128 Location: St Pete Beach, FL
|
Posted: Tue Mar 21, 2006 11:27 pm Post subject: |
|
|
I have sent Mike an email concerning his questions. I am interested in how he gets along with using the RC timing and his other mods.
The 16bit PID define is currently broken. I initially used 16bit calculations for the PID but found that 8 bit was more than sufficient so I switched. I wanted to have a define to go either way, but didnt go back and rework the 16bit pid back into the new source completely.
I havent been around much lately. I have had two contracts that have been strapping my time and had to put the robotics stuff down again.
C |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1029 Location: Manchester, UK
|
Posted: Wed Mar 22, 2006 1:04 am Post subject: |
|
|
| Quote: | | I have had two contracts that have been strapping my time |
let me guess... Hitman?
On a slightly more serious note... What is the smallest pin count PIC do you think this code could be squeezed into?
Barry |
|
| Back to top |
|
 |
mikewardlow
Joined: 16 Mar 2006 Posts: 42
|
Posted: Fri Mar 24, 2006 12:40 pm Post subject: 12F683 RC servo |
|
|
I cleaned up my code [using Colin's pid8.asm and must of broke something....I never seem to get anthing back from pid8 greater
than 0x10....and have not altered the pid8 code
Another note I am toying with trying a simple Brute Force Drive [BFD]
B F D [Brute Force Drive]
10 bit servo length
- 10 bit servo position
= 10 bit error
if NEG set -, set pre ccw 2's comp[error]
else
set +, set pre cw
endif
( may want to diddle with pwm period using prescaler 1:1 1:4 1:16)
if error > FF ( may want to change to 7F,3F,1F whatever) FF --> Wreg
else
error --> Wreg
( tune count for stop)
endif
Wreg --> preCCPR1L
;;;;;;;;;;;;;;;;;;;;;;;;
@ next T2 int
move preset cw/ccw & CCPR1L to actual
What's your thoughts |
|
| Back to top |
|
 |
stefanengelke
Joined: 03 Jan 2006 Posts: 59 Location: Stuttgart, Germany
|
Posted: Fri Mar 24, 2006 1:21 pm Post subject: |
|
|
Mike,
I'm not sure if I understand your BFD idea right, but it looks like a simple proportional controler with a saturation at ""FF ( may want to change to 7F,3F,1F whatever)"". The problem with a P-controler is, that it will be nearly impossible to supress vibrations or choosing the proportional factor to high the system may even become unstable.
Stefan |
|
| Back to top |
|
 |
mikewardlow
Joined: 16 Mar 2006 Posts: 42
|
Posted: Fri Mar 24, 2006 1:57 pm Post subject: BFD |
|
|
I'm thinking that when error is less than FF I use the decreasing error
amount in the duty cycle which will slow down the servo till stop....
I'm sure some simple fine tune servo drive may have to be implemented..
Years ago I worked on single capstan tape drives at GE plant in Phoenix,AZ. I remember that the capstan was started with a 5millisec
pulse,,,then optical tach controlled speed,,then a ?? millisec stop pulse
and friction/drag was dependant on vacuum pressures......
So I figure I can apply a stop pulse,,,dependant on load/friction/drag
[in other words guess] for stop length |
|
| Back to top |
|
 |
stefanengelke
Joined: 03 Jan 2006 Posts: 59 Location: Stuttgart, Germany
|
Posted: Fri Mar 24, 2006 2:35 pm Post subject: |
|
|
Ok, I see. Sounds like a combination of control-scheduling and map-based control.
Control-scheduling means to change control parameters (or even the whole control structure) dependent to time or the system state and map-based control is an additional precalculated signal mostly used to compensate non-linearitys. As you've already mentioned this precalculation requires the knowledge of the complete model but the identification of a more sophisticated friction/drag model is one of my next targets for the OpenServo anyway. This could probably help ""guessing"" the length of the stop pulse.
Your idea realy sound interesting and is worthwhile for futher investigations. |
|
| Back to top |
|
 |
mikewardlow
Joined: 16 Mar 2006 Posts: 42
|
Posted: Sun Mar 26, 2006 1:25 pm Post subject: BFD working rather good |
|
|
I have my BIG servo working pretty good..[havn't tried a load yet].
I need a little tighter control on my deadband...
Using very simple code [no mul""div]
It looks like the biggest problem will be the stopping resolution....
I'm using a 12F783 @ 8mhz with pwm enabled,,,but my simple h-bridge
is only using cw & ccw direction lines,,,,[still don't understand why this works] ....
Here's the code snippit that I am using
;=========================================================================================
BFD_calculate: MOVF SERVO_EH,W
skpnz ; Skip NI if EH > 0
GOTO EHisZero
MOVLW 0XFF ; PRELOAD 0xFF MAX CCP VALUE
;; DITTLE PERIOD???
MOVWF PID_RESULT
GOTO BFD_LOADED
;------------------------------------------------------------------------------------------
EHisZero: MOVF SERVO_E,W
SKPNZ
GOTO STOP_SERVO
ANDLW 0 ; CLR WREG
BTFSC SERVO_E,7
GOTO S7F ; REDUCE TO 0X7F
BTFSC SERVO_E,6
GOTO S3F
BTFSC SERVO_E,5
GOTO S1F
BTFSC SERVO_E,4
GOTO S0F
BTFSC SERVO_E,3
GOTO S03
;; MOVLW 5
;; MOVWF STALL
;; ? USE SOME AUTO TUNING TO SET FINAL AMOUNT
GOTO S00
S7F: IORLW 0X7F
S3F: IORLW 0X3F
S1F: IORLW 0X1F
S0F: ;; IORLW 0X0F ;;; APPEARS TO HAVE DEADBAND JITTER
S03: ;; IORLW 0X03
; ; CLRF STALL
; ; INCF STALL,F
GOTO P_SAVE
S00: ANDLW 0 ; INSURE WREG=0
;; TUNE STOP
;; DITTLE PERIOD??? ; skip NI if SERVO_E > 7F
;;;MOVF SERVO_E,W ; PRELOAD COMPUTED PID VALUE
P_SAVE: MOVWF PID_RESULT
;============================================================================================
BFD_LOADED: ANDLW 0XFF
SKPNZ
GOTO STOP_SERVO
btfss SERVO_STATUS, SSF_ENEG ; if ESIGN not set, we can now calc pid
goto CW
;--------------------------------------------------------------------------------------------
CCW: BCF INTCON, GIE ; DISABLE INTERRUPTS
BCF PRECW ; supress clockwise PWM
BSF PRECCW ; set counter clockwise PWM
movwf PRECCPR ; GPX = x10
BSF INTCON, GIE ; ENABLE INTERRUPTS
goto pid_loop
;--------------------------------------------------------------------------------------------
CW: BCF INTCON, GIE ; DISABLE INTERRUPTS
BCF PRECCW ; supress C-clockwise PWM
BSF PRECW ; set clockwise PWM
movwf PRECCPR ; GPX = x20
BSF INTCON, GIE ; ENABLE INTERRUPTS
goto pid_loop
;-------------------------------------------------------------------------------------------
stop_servo: BCF INTCON, GIE ; DISABLE INTERRUPTS
clrf PRECCPR ; no PWM output
BCF PRECW
BCF PRECCW
BSF INTCON, GIE ; ENABLE INTERRUPTS
goto pid_loop
;------------------------------------------------------------------------------------------- |
|
| Back to top |
|
 |
|