Closed Count Position work in Microbasic script

6 years 11 months ago #29528360 by edmodi
Hi, we are working with a system that use closed count position mode PID to move two robot motor. In the script, we follow the this process to configuration and send to concrete counter:

setConfig(_MVEL, 1, 10)
setConfig(_MAC, 1, 100)
setConfig(_MDEC, 1, 100)
setConfig(_MMOD, 1, OPEN_LOOP_MODE)
setConfig(_EMOD, 1, 34)

setConfig(_KP, 1, 70)
setConfig(_KI, 1, 0)
setConfig(_KD, 1, 0)
setConfig(_MMOD, 1, CLOSED_LOOP_COUNT_MODE)
setCommand(_P, 1, GetValue(_ABCNTR, 1))
wait(10)

setCommand(_P, 1, COUNTER_ZERO)

This process need that before send motor 1 to encoder/counter 0 read the actual value of counter and wait 10 ms. If not, the motor does not move.

If we try to do the same over Console tab, this read of actual counter is not necessary. Is a firmware bug?

Thanks

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

6 years 11 months ago #29528361 by Griffin Baker
Replied by Griffin Baker on topic Closed Count Position work in Microbasic script
I'm having a hard time understanding what exactly you are saying with this statement.

"This process need that before send motor 1 to encoder/counter 0 read the actual value of counter and wait 10 ms. If not, the motor does not move."

setConfig(_MMOD, 1, CLOSED_LOOP_COUNT_MODE) - should be setConfig(_MMOD, 3, CLOSED_LOOP_COUNT_MODE.

0 - open loop
1 - closed loop speed
2 - closed loop position relative
3 - closed loop count position
4 - closed loop position tracking
5 - torque mode

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

6 years 11 months ago #29528362 by edmodi
Ok, I'm sorry. I will rey to explaint again.

I say that to send a motor to some encoder position, I have to send a command _P with the actual position of motor encoder before to send a _P command with the desired encoder position that the motor must reach.

In console tab, this step is not nexesary but in microbasic scrip, i tried to si but not run. I have do the describe proccess

I hope explaint better

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

6 years 11 months ago #29528363 by Griffin Baker
Replied by Griffin Baker on topic Closed Count Position work in Microbasic script
setCommand(_P, 1, GetValue(_ABCNTR, 1)) you are setting the motor count to the motor 1 channel, using the counter value.
Maybe query the ABCNTR and use the print statement to relay back the value.

ABcounter = getvalue(abcntr, 1)

print ("count = ", ABcounter, "\r")

Then in the console tab, you can see what that value is.

Is this value stored each time?

So when running the script if the last count given is say 100. You send in the count to go to 100 again, the controller should already be there so the motor does not move. You'd have to issue a higher count command or lower to make the motor move, thus the encoder needing to be set back to 0.

I think the console tab should work in the same manner. If you set one of your channels in the run tab for counter 1, and then send the commands in console, you can then go back to the run tab to see where the count is.

Which version roborun+ are you using? The rev date is at the top where it says Motor control utility.

Also, what firmware is the controller running?

console tab
?fid

What is the date?

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

Moderators: tonysantoni
Time to create page: 0.096 seconds