LDC1430/60C project - questions for software writing

6 years 9 months ago #29528705 by Boarderbas
Dear all,

I'm Bas. I am a big fan of the Roboteq controllers and used them a few times. I'm currently doing a quite elaborately scripted project and there are a few q's I can't get answered reading the manual.

I'm currently printing the second copy of the manual as the first copy is worn out, so I do read it!

I'm opening this topic to answer my (silly) q's, so I don't have to pollute or hijack other peoples topics. I'll do my best to answer some questions of others to keep the balance.

1st qestion:

I'm planning to switch through 3 different control modes; constant torque, constant speed and tracking. When I switch to let's say constant torque, does the LDC keep track of the encoder? I need to allways know the home position.

2nd question:

User variables. I'd like to use them to juggle settings and commands between RS232 and the script. The project know two executions: a button panel wired to the controllers inputs and an RS232 execution. From the manual I gather this is where you use the user variables.

If I script:

SetCommand(_VAR, 1, 5) 'I expect to set VAR1 to 5 here
GetValue(_VAR, 1) 'I expect to get the 5 back I set the line before

If I run the script I get a popup asking me to input a value for VAR, 1. Obviously I do not know what I'm doing.

Anybody willing to comment?

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

6 years 9 months ago - 6 years 9 months ago #29528708 by Griffin Baker
Replied by Griffin Baker on topic LDC1430/60C project - questions for software writing
They way you are operating the script may be an issue. Are you clicking on the simulate button from the scripting tab? This will bring up a pop up box asking you to put in values because it is "simulating" the script and does not work the way it normally would.

If you "download to device" the script, and then go to the console tab, and send in the !r, it should run the script. You can also click on the "Run" button at the top of browser where it says script (Run and Stop buttons).

Edit: Also you'll want to set up a print statement after getvalue.

var1 = getvalue(_Var, 1)
print("Var 1 = ", var1, "\r")
wait(1)

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

6 years 9 months ago - 6 years 9 months ago #29528710 by Boarderbas
Thanks for the excellent reply. I now know what to do and understand why I did it wrong.

Hopefully my stuff is in the mail to connect the motors to the battery banks to do some real testing. Maybe I can figure the encoder issue out myself.


By the way, roboteq engineers, if CAN would be available on the LDC1430 in the near future I WILL send you flowers.

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

6 years 8 months ago #29528736 by Boarderbas
I finally found time to hook things up properly.

I have a 50 cpr encoder hooked up to an 700W motor.

I am stuck at the basics. I try to run the motor for from a script;

setcommand(_G,1,1000)

In open loop, it runs for a second or so

If I set the encoder as feedback and the motor mode in closed loop speed, it starts to run and then very slowly comes to a halt in 15 seconds or so.

Any guess why it won't just keep running?

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

6 years 8 months ago #29528737 by Griffin Baker
Replied by Griffin Baker on topic LDC1430/60C project - questions for software writing
That would be the watchdog timer causing the motor to stop. The watchdog timer will sleep if it doesn't see a command issued every 1 sec. You can either increase the time it stays on or disable it completely.

^RWD 0

The Time is done in mS, so if you want 5 seconds it would be ^RWD 5000

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

6 years 8 months ago #29528738 by Boarderbas
That was my guess for the open loop.

(by the way, that was a fast response!)

So the exact same thing happens on the closed loop mode? How can I see the encoder count/ I remember on this forum it was told you can monitor it on the console?

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

6 years 8 months ago - 6 years 8 months ago #29528739 by Griffin Baker
Replied by Griffin Baker on topic LDC1430/60C project - questions for software writing
Yes. If you send in the ?C, this will query the encoder count.

If you follow up with a #10, this will query the ?C every 10mS.

Also in the closed loop, it could also be the loop error detection causing your motor to stop. You can disable that in your closed loop parameter.

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

6 years 8 months ago #29528741 by Boarderbas
Very helpful. I'm a bit embarrassed to get stuck in the basics. I really thought I had a good grasp on the technology...

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

6 years 8 months ago - 6 years 8 months ago #29528751 by Boarderbas
Ok,

I have my code 80% finished, but I have to run it without watchdog.

As this is something human operated it is mandatory I use it, but I can't keep the dog from stopping my motors.


This is the part of the code that is driving the motor:
If ClutchState = 1 Then
		Print("Furling\n")
		SetConfig(_MMOD,1,1) 
		Do While GetValue(_ANAIN,3) > GetConfig(_AMAX,3) - AnaBwidth
			SetCommand(_G,1,1000) 
			Print("f")
			Wait(10)
		Loop
		Print("\nFurl Stop\n")
		SetCommand(_G,1,0) 
		SetConfig(_MMOD,1,0)
	Else

When I press a button connected to an analog input the If is evaluated as true and the motor is set in sclosed loop speed mode
It checks if the button is still pressed and sends a new motor command every 10ms

This prints:

Furling
ffffffffffffffffffffff
Furl stop


Somewhere halfway the printing of te ffff's the motor stops and it prints "Furl stop" after I release the button.

The strange thing is that the code worked. After I added the "-" to the "SetCommand(_G,1,1000)" value it stopped working, after removing the "-" it still wouldn't work....

I checked my wiring. Any motor command will result in full speed motor and if I reverse the motor leads the motor acellerates in a shocking fashon to eventual maximum..

Hate to bother you again, but could you offer some help?

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

6 years 8 months ago #29528752 by Griffin Baker
Replied by Griffin Baker on topic LDC1430/60C project - questions for software writing
Off the top of my head.

The mmod, 1, 1 is a closed loop speed mode. Is the loop error detection still enabled or is completely disabled?

The print "f", is that supposed to print that many f's? maybe use
print("f /n")

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

Moderators: tonysantoni
Time to create page: 0.162 seconds