Menu

Topic-icon Encoder Setup after controller reset

More
3 years 3 months ago - 3 years 3 months ago #29532254 by Zurad
I use roboteq SDC2160 controller with 2 DC motors and encoders (500 lines)
After controller reset it seems like some values are not getting updated and one of the encoders (enc 1) returns value -1.
Because of that my close loop controller breaks. When I manually reset controller to default values and then run the script again everything works fine. am I missing something with the configuration? My config:


setconfig(_ECHOF, 0) ' Serial echo off (p195)
setconfig(_RWD, 0) ' Watchdog timeout, milliseconds (p195)
setconfig(_AMOD, 1, 0) ' Analog input 1 absolute mode
setconfig(_AMOD, 2, 0) ' Analog input 2 absolute mode

' Undervoltage/overvoltage limits (p214)
setconfig(_OVL, 300)
setconfig(_UVL, 120)

' Encoder, speed config (p208, p221)
setconfig(_EMOD, 1, 18)
setconfig(_MXRPM, 1, 6000)
setconfig(_EPPR, 1, 500)

setconfig(_EMOD, 2, 34)
setconfig(_MXRPM, 2, 6000)
setconfig(_EPPR, 2 , 500)

' Current limit (p216)
setconfig(_ALIM, 1, 70)
setconfig(_ATGA, 1, 16)
setconfig(_ATGD, 1, 50)
setconfig(_ATRIG, 1, 0)

setconfig(_ALIM, 2, 70)
setconfig(_ATGA, 2, 32)
setconfig(_ATGD, 2, 50)
setconfig(_ATRIG, 2, 0)

' Max acceleration/deceleration (p219)
setconfig(_MAC, 1, 8000)
setconfig(_MDEC, 1, 30000)
setconfig(_MAC, 2, 8000)
setconfig(_MDEC, 2, 30000)

' Closed-loop control (p216-218)
setconfig(_MMOD, 1, 1)
setconfig(_KP, 1 , 0)
setconfig(_KI, 1 , 2)
setconfig(_KD, 1 , 0)
setconfig(_ICAP, 1, 100)

setconfig(_MMOD, 2, 1)
setconfig(_KP, 2 , 0)
setconfig(_KI, 2 , 2)
setconfig(_KD, 2 , 0)
setconfig(_ICAP, 2 ,100)


EDIT:

I've found the solution it turns out I didn't disable Pulse Input and after reset it went to default value causing encoder 1 to not work.

I've added to script
setconfig(_PMOD, 1, 0)
setconfig(_PMOD, 2, 0)

and it works well

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #29532257 by blake
Glad you were able to find the cause of the problem.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.085 seconds
Go to top