starting with micro basic script for complete newby

7 years 2 months ago #29528283 by steadirob
I have to admit that just looking at the scripting manual gives me shivers...
I do not know where and how to start as it is complete new to me.

So far I have my system (a \"cable-cam\") running and the controller performs well.
But I need to add safety features: limit switches near the end of the cable.

for that I mounted an absolute encoder/ digital potentiometer to the wheel, which is adjustable to the number of rotations, at this moment set at 50. This is equal to approx 61 meters which is probably more than my longest cable run.

Via the analog input options I am able to reduce the allowed movement with the calibrate option and select the \"min/max limit switch\" option as action.
The result is that the controller stops indeed immediately when reaching either limit, but it does that instantly which gives a violent swing to the whole contraption.

I understand that I can also start a script when reaching the limits so I like to know how I can make a script that slows down the cable-cam to zero, at a reasonable deceleration like 600rpm/s as I have found to work nicely.
It should also not be allowed to move further, only in the opposite direction.

all help and hints appreciated!

thanks,
Rob
Attachments:

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

7 years 2 months ago #29528284 by Griffin Baker
Replied by Griffin Baker on topic Re:starting with micro basic script for complete newby
You would want to setup the script so that the max accel and decel get set to a ramping down mode.

I think a couple of things might want to happen before a limit switch operation.

You would want to set your max accel and decel lower to cause a slow decline in speed in relation to the motor command. Example below for motor 1.

setconfig(_MAC, 1, 200)
setconfig(_MDEC, 1, 200)

Then you would want to then give the motor command to go to 0 to basically tell the motor to stop.

You would have to set an if then statement where if the motor has stopped after reaching the point where the script gets enabled to only allow for the motor to go in the opposite direction command.

You could then set the config that changes the analog command polarity to inverted so that if the command is brought back into range, that the command is inverted.

These are just some ideas.

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

7 years 1 month ago #29528352 by steadirob
Hi Griffin, I've setup the Configuration so that the Deceleration is at 600 rpm/m and this gives me a smooth slowdown if i release the joystick to zero.
This is in every position, not only when passing the limits.

I tried several options, given in the action list when reaching a Min or Max value.
When using the Limit Switch option, the motor comes to a sudden (violent) stop.

The Dead Man switch behaves basically as I would like to see it: it uses the pre-set deceleration to come to a stop. However, after that the input of the joystick is disabled (PLI1) and I cannot move out of that position anymore.

Is there any way to get a controlled deceleration on the Limit Switch option, without scripting?

Regards,
Rob

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

4 years 9 months ago #29531617 by jonas.burnickis@gmail.com
hi


do you manage to write the script?

because i solving the same problem

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

4 years 9 months ago #29531618 by niko
Have a look at the user manual. Furthermore in Download Center you will find some script samples.

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

1 year 7 months ago #29534566 by little
Did anyone make any progress on this issue? I have the same problem and do not know how to encode in Basic

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

1 year 7 months ago #29534567 by little
Maybe make a script that will calculate when it should slow down at a speed of 600rpm / s, given the current speed and the distance from the min / max limit switch point? In that way, stopping would be soft.

Something similarly described here , should only be transferred to the MicroBasic world and RoboRun. If there is someone to help, I would be very grateful. If someone want a beer or two - my treat. Just let me know in the inbox.

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

Time to create page: 0.118 seconds