VDC2450 joystick control with motor using absolute potentiometer feedback

9 years 4 months ago #29528774 by Griffin Baker
I guess what is the purpose of your feedback, if all you're doing is telling the motor to go a position and then hold if your motor command is going to change? What would then tell your motor to release from that position?

If you drive a car and tell it to go to 60mph and then release the gas pedal, the car would then start to slow down. What happens is that to hold that position, you have to use cruise control and set it to that exact speed.

A script could be written so it does something similar, but you have to put something in there that would release the cruise control mechanism.

In the script you would tell the motor command to follow the joystick, but then if you want to maintain and hold that position using the feedback while changing the joystick value, you'd have to tell the script to set the feedback to the joysticks value until a locking mechanism is trigger to maintain that value in the feedback so it doesn't change with the joystick command change.

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

9 years 4 months ago #29528775 by jonshepley
I see what your saying, the reason for the positional feedback is that the motor can be moved by external forces, so for example if wind pushes the motor to rotate then i want the feedback to correct for this and hold its position, its tricky because i guess the "curise control" button in this is the joystick being in its home position. I think i'm going to have to give it some thought like you say to work out how i'm going to do the switching between positional hold and going to a target position

Thanks,

Jon

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

9 years 4 months ago #29528776 by jonshepley
Ok so I think I have a plan:

The system is setup to run open loop but with a script running as follows, it operates in open loop unless no joystick input is detected (i.e. both analog inputs are at 2500, in scripting is there an "in deadband" parameter i could utilise, just a simple boolean stating weather the input is within the deadband would be ideal) in that case it goes into closed loop, however it would need to be closed loop to a feedback value saved to a variable, can you do this in your script (i.e. when deadband detected it will save the current feedback value, say 345mV, then maintain that position until deadband is no longer detected)

does that sound at all possible with the paramaters available in the scripting console?

Thanks,

Jon

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

9 years 4 months ago #29528777 by Griffin Baker
Having a little difficulty in interpreting this correctly, so please correct me where I am mistaken.

So the motor starts in open loop and while the analog feedback for both motors are centered within their deadband ranges.
Once the analog input(s) goes outside of that deadband range, it tells the motor to go into a closed loop mode to a pre-defined value.

I think the tricky part is storing a constantly queried value as the value will change. Maybe if you set a logic flow that if this value becomes within a set of limits, it will store a specific value which will then become a motor command.

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

9 years 4 months ago #29528778 by jonshepley
Sorry i'm obviously doing a terrible job explaining myself.

The system is effectivly closed loop when the joystick is in the deadband, it should read the position of the motors into a variable at this point (while they are stationary) and then simply maintain that position until the joystick is moved out of the dead band.

When the joystick leaves the deadband the system switches to open loop so the opertor can move to another position, once the joystick returns to the deadband it goes back into closed loop as above.

It's not perfect beacuse it cannot compensate for external proces acting on the motors during the joystick move, however I think it will be sufficent for what we are doing

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

9 years 4 months ago #29528779 by Griffin Baker
So if by default the configuration is set to closed loop mode, then upon start up it will be so until something triggers it out.

You'd have to determine what these limits are within the deadband range from your 2500 point. So if it is 5%, then the range that keeps it in the closed loop mode is 2625 and 2375. You would then query your analog input value of the joystick so that when it falls out of that range, the mode switches into open loop mode.

We have a sample script that you can look at, that you can adjust to achieve just that.

dev.roboteq.com/dev1/index.php/support/downloads

Located near the bottom. "Sample Scripts"

Just noticed there is a typo in the remark statement for it in the last setconfig parameter.
setconfig(_MMOD, 2, 0) ' switch to open loop channel 1 motor if command is 0

should read:
setconfig(_MMOD, 2, 0) ' switch to open loop channel 2 motor if command is 0

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

9 years 4 months ago #29528780 by jonshepley
Yes i've been looking at the samples and found the one you mentioned, i think i should be able to do it withought too much problem, then I just need to add limit checking to it. The tricky part with that is once it hits a limit it needs to stop the motor traveling further in that direction but alow it to come back from it. The limits are going to be settable with buttons. So for example you would position the motor to its max position then hold down the max limit button and it will store that as its new max limit. There will be an LED for each limit showing when it has been reached and of course set.

It's a shame there isn't a call in the scripting to have a bool for "IsDeadband" or something, so you could just change the variable in one place (the configuration tab in the software).

Thanks for all your advice on this, i'm sure i'll figure it out anyway.

Jon

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

9 years 4 months ago #29528781 by Griffin Baker
If you have a defined max limit, then your logic statement can say if the analog value <= #, then motor command = specified value.

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

9 years 1 month ago #29529095 by jonshepley
Hi, just tryin to think of a simple solution to this, is there a way in the programming of asking the motor channel to maintain a spacific feedback voltage? so say i wanted to to maintain its position at 3000mv?

Thanks, Jon

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

9 years 1 month ago #29529096 by Griffin Baker
Please be a little more specific. When is this voltage supposed to be maintained? As soon as the script starts?

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

Moderators: tonysantoni
Time to create page: 0.103 seconds