Closed loop position/count tracking in Mixed Mode

9 years 11 months ago #29528477 by allen
I'm trying to have a python/C program send relative position commands via USB to a HDC2450 operating in Mixed Mode. I have the encoders configured for "feedback1" and "feedback2". So far, Mixed Mode 1 works perfectly with Roborun's run-tab, and RC control (channel 1=both motors turn the same way, channel 2=the two motors turn in opposite directions).

However, I am a bit confused to what commands to send. In console, entering a string of commands in the form of "!G [nn] [mm]", where [nn]={1,2,3,4}, and [mm]={-2500...2500} gives unpredictable, inconsistent actions from the motors. For example, "!G 1 1000" might have both motors turn in the same way, "!G 1 -1000" might have them turn the other way, but "!G 1 500" might have the motors turn the opposite way a different amount, and then "!G 1 1000" might cause just one motor to turn.

Further, every motor movement in one way is followed by the movement of the exact same amounts in the opposite direction, resulting in net 0 movements after the execution of such a command. I have also queried "!S", which gives mostly "0:0", confirming the fact.

Please let me know what commands I should be sending to the controller in mixed-mode (I see nothing about it in the manual), and whether I'm experiencing a buggy controller.

Thanks,
Allen

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

9 years 11 months ago #29528480 by Griffin Baker
Replied by Griffin Baker on topic Closed loop position/count tracking in Mixed Mode
Each mixed mode has a different affect on the commands given. If you look at the chart in the user manual, it shows the relationship of the command given and the resulting turn and motor behavior effect. Page 76.

Also, in the console tab, is the watchdog timer still enabled or disabled? To disable use ^RWD 0 or to change to a different value in mS, use ^RWD [value].

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

9 years 11 months ago #29528482 by allen
Hi Griffin,

Thanks for pointing out that chart. But something is not consistent here. In mixed mode, channel 1=throttle, and channel 2=steering. In the commands I used, "!G 1 [mm]", the commands are only sent to channel 1. Now the chart never shows what happens when throttle is non-zero and steering=0, but I'm assuming I should have the motors turn the same amount in the same direction...which is not the case.

Secondly, assuming everything does work as expected according to the chart, to produce for example in Mixed Mode 1 M1=600, M2=0, I need throttle=300 and steering=300. This means sending 300 to channel 1 AND 300 to channel 2 at the same time. What commands can I use to achieve this?

Regarding the watchdog timer...is this what's causing the reversal of the motors after executing commands?

Thanks,
Allen

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

9 years 11 months ago #29528483 by Griffin Baker
Replied by Griffin Baker on topic Closed loop position/count tracking in Mixed Mode
The watchdog timer merely shuts off the motor commands every time it times out. So by default, it has to receive a command every 1 sec or it goes to sleep until the next command is seen. Whatever command was issued before will start up again. So if motor 1 was given a command of +500 and it times out, then motor 1 stops until the next command is given. So if motor 2 is given a command, the motor 1 will start up again as the watchdog timer wakes up.

When no command is given, the motors should spin giving the forward direction movement. When the channel 2 changes, then the motor 2 channel will either speed up or slow down causing a turn.

Throttle will cause a movement either in the forward or reverse direction. The steering will compensate the turn by adjusting the motor 2.

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

9 years 11 months ago #29528487 by allen
I don't quiet understand your explanation of the watchdog timer:
1) Is there only one watchdog timer for the entire controller, or one for each motor?
2) What do you mean "if motor 1 was given a command of +500 and it times out"...do you mean after the motor finishes executing the command, or when the motor fails to execute that command within a time-out limit?
3) Assuming the former in (2), then you're saying, if I give Motor 1 "+500", then give Motor 2 "+500", I will see motor 1 spin forward, and then BOTH motor 1 and motor 2 spin forward together?!?
4) How does disabling the watchdog timer help me? Is this what's causing the reversal of the commanded motor movements?

I understand what throttle and steering do. I'm asking what commands to send to do this. For example, if I want {M1=900, M2=300} for t seconds, this correspond to having {throttle=600, steering=-300} for t seconds, what commands should I be sending?

"!G 1 600" and "!G 2 -300" sequentially? I know this does not give the desired reaction when done from the Roborun console. But if sent through a script, such that the two commands are executed by the controller within very short time of each other, would this cause the desired behavior?

Or in general, how do I have both motors executing commands at the same time?

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

9 years 11 months ago #29528511 by allen
bump

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

Moderators: tonysantoni
Time to create page: 0.064 seconds