08-22-2014 09:16 AM
I´ve modified the code putting some "waits" but it seems to me not too professional. If motor goes too far, when returning to home it spends a lot of time but not always the same. Any idea how to improve the code? It should be something that instead of time in seconds would act with an order. I´ve been trying to tell the motor to stop when a position is reached but there is no driver for that, so...
Thanks people!!
08-22-2014 09:29 AM
Hi lacorgui,
as said before: you need to check, if your motor has reached its goal position. Only then you should go to the next state…
Instead of have different states for going to zero and some arbitrary position you should use only one state for going to arbitrary position. This state takes the goal position as parameter and only exits (apart from error checking) when the postion is reached!
08-22-2014 09:48 AM
I see what you say GerdW, but I do not know how to check that. In MoveNextX and MoveNextY stages I make a comparison of values between final position and actual position in order to go to the next stage, however the process is quicker than motors movement.
Moreover I´m using Lab 9 and I´m not able to add more stages to the state machine, sorry (maybe is fault of my lack of knowledge in Labview).
Anyway, I´ll try to think about it this weekend! Enjoy yours too!!
08-22-2014 09:55 AM
@lacorgui wrote:
I see what you say GerdW, but I do not know how to check that. In MoveNextX and MoveNextY stages I make a comparison of values between final position and actual position in order to go to the next stage, however the process is quicker than motors movement.
Moreover I´m using Lab 9 and I´m not able to add more stages to the state machine, sorry (maybe is fault of my lack of knowledge in Labview).
Anyway, I´ll try to think about it this weekend! Enjoy yours too!!
I think it is probably your skill level with LabVIEW. I haven't taken a look at your code, but your state machine is probably controlled by enum? The only way you will be able to add new states is to add new items to the enum. Your case structure will then know about these new states. It's up to you to figure out how to add them to the case structure, since there are several ways, each with their own pros and cons.