Can't get motor to move
- helpplease
- Topic Author
7 years 6 months ago - 7 years 6 months ago #29531761
by helpplease
Can't get motor to move was created by helpplease
I'm a complete newbie when it comes to Roboteq so sorry if this seems like an obvious question, but I can't seem to get the motor I've hooked up to move in Closed Loop mode. I can get it to move in Open Loop mode using the Command sliders on the Run tab of Roborun, but once in Closed Loop Count Position mode I can't figure out a script to move the motor. I've tried setcommand(_G, 1, 1000) to get it to move to a specific count, but nothing happens. Using serial commands in python I can read the encoder count (so it's at least connected correctly) but I can't figure the correct syntax to move the motor. Ultimately I'll want to control it using serial and the !G format, but for now I can't get the motor to work in either serial or MicroBasic.
**Sorry this isn't exactly relevant to MicroBasic anymore
**Sorry this isn't exactly relevant to MicroBasic anymore
Please Log in or Create an account to join the conversation.
7 years 6 months ago #29531770
by niko
Replied by niko on topic Can't get motor to move
Hello,
In order to move motor with Closed Loop Count Position you need to choose command P. For more details check section 10 of the user manual.
If you want to use slider (or the G command) for going to position, then you should use Closed Loop Count Position Relative. For more details advise section 9 of the user manual.
In order to move motor with Closed Loop Count Position you need to choose command P. For more details check section 10 of the user manual.
If you want to use slider (or the G command) for going to position, then you should use Closed Loop Count Position Relative. For more details advise section 9 of the user manual.
Please Log in or Create an account to join the conversation.
- helpplease
- Topic Author
7 years 6 months ago #29531772
by helpplease
Replied by helpplease on topic Can't get motor to move
Thanks, I reread through the manual and caught that but still have a few questions.
From what I've read command P is supposed to move the motor to a specified count, right? Because when I use "!P 1 1000" the motor just spins continuously in one direction and doesn't stop at the specified count but continues to move until emergency stop. I've tried disabling and re-enabling the watchdog timer with the ^rwd command but nothing changes. Even changing the value after "!P 1" to a negative number or different value doesn't seem to change motor direction or the way it's moving.
This is under Closed Loop Count Position, Encoder 1 set to Feedback 1, and Loop Error Detection and Stall Detection disabled.
From what I've read command P is supposed to move the motor to a specified count, right? Because when I use "!P 1 1000" the motor just spins continuously in one direction and doesn't stop at the specified count but continues to move until emergency stop. I've tried disabling and re-enabling the watchdog timer with the ^rwd command but nothing changes. Even changing the value after "!P 1" to a negative number or different value doesn't seem to change motor direction or the way it's moving.
This is under Closed Loop Count Position, Encoder 1 set to Feedback 1, and Loop Error Detection and Stall Detection disabled.
Please Log in or Create an account to join the conversation.
7 years 6 months ago #29531775
by niko
Replied by niko on topic Can't get motor to move
This could be because the encoder connection is not correct. Go back to open loop and set command 200. Make sure encoder counter goes up. The set command -200. Make sure encoder counter goes down. If it is vice versa swap encoder pins A and B.
Please Log in or Create an account to join the conversation.
- helpplease
- Topic Author
7 years 6 months ago #29531779
by helpplease
Replied by helpplease on topic Can't get motor to move
Would that be using !C 1 200 and !C 1 -200? I went back to open loop and it worked initially but now anytime I send any !C command the encoder resets to that value and then immediately runs the motor for the last specified watchdog time even though there's no movement command.
For example, if I send "!C 1 200" it resets the encoder to 200 but then turns for 1 sec and stops around count -610. I tested a !G command (!G 1 1000_^rwd 1000) a few minutes before that and then cleared it from the out data, but it seems like "!C 1 200" or any similar !C command is now directly followed by a mimicked !G command without be prompted to do so.
For example, if I send "!C 1 200" it resets the encoder to 200 but then turns for 1 sec and stops around count -610. I tested a !G command (!G 1 1000_^rwd 1000) a few minutes before that and then cleared it from the out data, but it seems like "!C 1 200" or any similar !C command is now directly followed by a mimicked !G command without be prompted to do so.
Please Log in or Create an account to join the conversation.
- helpplease
- Topic Author
7 years 6 months ago #29531781
by helpplease
Replied by helpplease on topic Can't get motor to move
You were right about the encoder connection - even though the pins were hooked up correctly the motor being connected to a gear box caused the signals to be backwards, resulting in strange encoder readings dictating the motor movements. We switched the motor leads and it seems to all be working correctly now in both open and closed loop. Thanks!
Please Log in or Create an account to join the conversation.
Time to create page: 0.071 seconds