Menu

Topic-icon MDC2460 with analog position sensor and one motor

More
5 months 1 week ago - 5 months 1 week ago #29534453 by vector
I am trying to use an analog position sensor (a string pot) with a linear actuator controlled by the Roboteq. The sensor is connected to the linear actuator arm, not the motor. The motor does not have a sensor on it. It goes through probably a worm gear or something to move the actuator. I attached my config. I wrote the script below and run it through the Roborun windows utility (awesome utility, BTW.) Anyway, when the script is run, the actuator moves through the range a couple of times slowly, as it should. If I simply execute a command to position the actuator at one end or the other, I get strange results. Any large movement request produces strange results. It also doesn't seem to move in reverse as fast as it does in the forward direction.

So, for example, actuator is at the fully retracted position (-1000) and sensor has a value of around 3.790v. I issue a manual command through roborun console via "Out Data" fields. Say, !G 1 0 (to center) or even !G 1 1000 (to fully extended position with sensor at about 1.710v). The actuator does nothing on the 1000 setting unless I issue intermediate position commands like !G 1 -750, !G 1 -500, !G 1 -250, !G 1 0, !G 1 250, !G 1 500, !G 1 750. Going from fully extended at +1000 to fully retracted at -1000 causes it to move to a position slightly less than center and then stop and repeated commands do nothing even though it isn't anywhere near fully retracted.

I have a rotary pot connected to pin4 (ANA1) and the position sensor (string pot) connected to pin 15 (ANA6). I have tested this with and without the analog rotary pot configured for motor command on pin 4 connected. I was using that for manual control under Open Loop until I switched to this. It's ultimately USB control I'm after anyway, but I may configure the controller and/or write scripting to support both later for testing and diagnostic purposes.

Option Explicit

Dim iteration As Integer
Dim iterations As Integer
Dim increment As Integer
Dim minPosition As Integer
Dim maxPosition As Integer
Dim i As Integer

iteration = 0
iterations = 2 'iteration represents one motion in one direction.
increment = 50
minPosition = -1000
maxPosition = 1000

For i = 0 AndWhile iteration < iterations Evaluate i += increment
	If i < minPosition Or i > maxPosition Then
		increment = -increment
		iteration++
	Else
		SetCommand(_GO, 1, i)
		Print("Setting motor using _GO to value of: ", i, "\n")
		wait(250)
	End If
Next
Attachments:

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

More
4 months 4 weeks ago #29534488 by Gabriel_Isko
Are you only experiencing this when you use the analog sensor? Probably has more to do with the guard band safety than intermediate commands.

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

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