sdc2130
- Michael Burton
- Topic Author
- Offline
Less
More
- Posts: 64
- Thank you received: 1
12 years 7 months ago #29525383
by Michael Burton
sdc2130 was created by Michael Burton
Support,
I have several questions.
I have written a script to read the analog inputs and set the motor positions. I also se the digital outputs.
The motors do not respond to my position commands. I use this command.
SetCommand(_MOTPOS,newleftmotorpos, newrightmotorpos)
Nothing happens.
Another problem I am having is that the controller looses communication with the computer on a regular basis. It just stops responding and I am forced to reset it.
Perhaps you could help me with configuration of the controller.
I have set it to analog mode and set the script to auto load.
I set the analog inputs to relative and leave all the boxes unchecked.
I have some print commands that are in the script that can be triggered by activating one of the digital inputs. If the computer is connected to the controller on startup I do not see the output text from the script. If I then reset the controller I see the script output. I have set analog as the command priority.
I am not sure how the controller should be setup. I want the script to be in command of the motor position and reading the analog inputs.
I would be happy to include the script but do not want it posted to the forum.
Michael
I have several questions.
I have written a script to read the analog inputs and set the motor positions. I also se the digital outputs.
The motors do not respond to my position commands. I use this command.
SetCommand(_MOTPOS,newleftmotorpos, newrightmotorpos)
Nothing happens.
Another problem I am having is that the controller looses communication with the computer on a regular basis. It just stops responding and I am forced to reset it.
Perhaps you could help me with configuration of the controller.
I have set it to analog mode and set the script to auto load.
I set the analog inputs to relative and leave all the boxes unchecked.
I have some print commands that are in the script that can be triggered by activating one of the digital inputs. If the computer is connected to the controller on startup I do not see the output text from the script. If I then reset the controller I see the script output. I have set analog as the command priority.
I am not sure how the controller should be setup. I want the script to be in command of the motor position and reading the analog inputs.
I would be happy to include the script but do not want it posted to the forum.
Michael
Please Log in or Create an account to join the conversation.
- roboteq
12 years 7 months ago #29525385
by roboteq
Replied by roboteq on topic Re:sdc2130
First never make a script autostart until you have thoroughly checked it. If a faulty script autostarts, you may get in a situation where the controller immediately launches the script after booting and if the script crashes, it will be very hard to recover (it is always possible, however).
Then, the position commands are given with the _GO command. In this case, the position value is a number from -1000 to +1000 and works the same as when moving the slider when operating the controller manually.
The _MOTPOS command is for giving position values in number of encoder counts. This is for another position mode that will shortly be released in an upcoming firmware revision.
If you expect the script commands to have the highest priority, then you must have the serial as high priority. Script issued commands are at the same level as serial commands. Beware that if you send commands via USB or RS232, these will be of the same priorty as script commands and will interfere. You should not send commands via serial/usb while the script runs. When Roborun is on the Run tab, click on the Mute check box to stop commands from being issued via serial/usb.
We know of cases where communication is lost when using USB and when the environment is noisy (i.e motor running). USB is not a very robust when it comes to operating in an electrically noisy environment. We are working at improving this but, in the meantime, if this is a problem for you, considering operating the controller in RS232 mode. RS232 is far simpler than USB and will always recover after losing communication.
Then, the position commands are given with the _GO command. In this case, the position value is a number from -1000 to +1000 and works the same as when moving the slider when operating the controller manually.
The _MOTPOS command is for giving position values in number of encoder counts. This is for another position mode that will shortly be released in an upcoming firmware revision.
If you expect the script commands to have the highest priority, then you must have the serial as high priority. Script issued commands are at the same level as serial commands. Beware that if you send commands via USB or RS232, these will be of the same priorty as script commands and will interfere. You should not send commands via serial/usb while the script runs. When Roborun is on the Run tab, click on the Mute check box to stop commands from being issued via serial/usb.
We know of cases where communication is lost when using USB and when the environment is noisy (i.e motor running). USB is not a very robust when it comes to operating in an electrically noisy environment. We are working at improving this but, in the meantime, if this is a problem for you, considering operating the controller in RS232 mode. RS232 is far simpler than USB and will always recover after losing communication.
Please Log in or Create an account to join the conversation.
- Michael Burton
- Topic Author
- Offline
Less
More
- Posts: 64
- Thank you received: 1
12 years 7 months ago #29525387
by Michael Burton
Replied by Michael Burton on topic Re:sdc2130
I have changed back to the go command but without any motor movement. I send the commands and nothing happens. I have rs232 as the only value in the command priority.
setcommand(_go, 1, newleftmotorpos)
setcommand(_go, 2, newrightmotorpos)
As a note if I set the position mode to open loop speed I can get the motor to move.
I still have problems with the serial communications stopping or at least nothing comes through the console.
here is a test script I tried. It runs but nothing happens
setmotorpos:
do
setcommand(_go, 1, newleftmotorpos)
setcommand(_go, 2, newrightmotorpos)
newleftmotorpos += 100
wait(500)
Print(\"\\n left motor pos = \",newleftmotorpos, \", right motor pos = \", newrightmotorpos)
loop while newleftmotorpos < 1000
The motors do run and respond to the computer when I have it talk to roborun+ and change the mode to open loop speed.
setcommand(_go, 1, newleftmotorpos)
setcommand(_go, 2, newrightmotorpos)
As a note if I set the position mode to open loop speed I can get the motor to move.
I still have problems with the serial communications stopping or at least nothing comes through the console.
here is a test script I tried. It runs but nothing happens
setmotorpos:
do
setcommand(_go, 1, newleftmotorpos)
setcommand(_go, 2, newrightmotorpos)
newleftmotorpos += 100
wait(500)
Print(\"\\n left motor pos = \",newleftmotorpos, \", right motor pos = \", newrightmotorpos)
loop while newleftmotorpos < 1000
The motors do run and respond to the computer when I have it talk to roborun+ and change the mode to open loop speed.
Please Log in or Create an account to join the conversation.
- roboteq
12 years 7 months ago #29525389
by roboteq
Replied by roboteq on topic Re:sdc2130
The script looks correct.
Check that you can get the motor to move using the roborun+ sliders when configured in closed loop.
Is this working?
If not, check that you properly configured the feedback.
Check that you can get the motor to move using the roborun+ sliders when configured in closed loop.
Is this working?
If not, check that you properly configured the feedback.
Please Log in or Create an account to join the conversation.
- Michael Burton
- Topic Author
- Offline
Less
More
- Posts: 64
- Thank you received: 1
12 years 7 months ago #29525391
by Michael Burton
Replied by Michael Burton on topic Re:sdc2130
As I posted this does nothing and the sliders do work but only in open loop speed. I can not get it to move in closed loop position mode.
Please Log in or Create an account to join the conversation.
- Michael Burton
- Topic Author
- Offline
Less
More
- Posts: 64
- Thank you received: 1
12 years 7 months ago #29525393
by Michael Burton
Replied by Michael Burton on topic Re:sdc2130
How would you have me configure the feedback? I have tried many things.
Please Log in or Create an account to join the conversation.
- roboteq
12 years 7 months ago #29525395
by roboteq
Replied by roboteq on topic Re:sdc2130
It depends on the feedback sensor.
Assuming that you have a potentiomenter, you have to go to the configuration tab, sected the analog input channel on which the sensor is connected and then set it as feedback for the desired motor channel.
There is a bit more to it as you have to select a few more paramters for the analog conversion (type, range, ...). See the user\'s manual for info on how to make a closed loop system and the things to watch for.
Then, run the closed loop via the roborun slider. Use the script only after you have successfuly operated via the slider.
Assuming that you have a potentiomenter, you have to go to the configuration tab, sected the analog input channel on which the sensor is connected and then set it as feedback for the desired motor channel.
There is a bit more to it as you have to select a few more paramters for the analog conversion (type, range, ...). See the user\'s manual for info on how to make a closed loop system and the things to watch for.
Then, run the closed loop via the roborun slider. Use the script only after you have successfuly operated via the slider.
Please Log in or Create an account to join the conversation.
- Michael Burton
- Topic Author
- Offline
Less
More
- Posts: 64
- Thank you received: 1
12 years 7 months ago #29525397
by Michael Burton
Replied by Michael Burton on topic Re:sdc2130
It is a pot and I have set the feedback to the proper analog input. I did not have it set for the motor. I put this test code in the controller and it is now working.
Thanks for the help. some times it just takes talking through it to see where I have made a mistake. I will put my old code back into the controller and see what happens. I have done testing in simulation mode to make sure it will not crash. I also put a 500 ms delay in the start up code so that I have time to abort.
I have found that if the USB is connected it does not auto run the code even when it is set on auto run. Is this a bug or just a way to break into a locked up controller?
What is the best way to start the script during testing.
Thanks for the help. some times it just takes talking through it to see where I have made a mistake. I will put my old code back into the controller and see what happens. I have done testing in simulation mode to make sure it will not crash. I also put a 500 ms delay in the start up code so that I have time to abort.
I have found that if the USB is connected it does not auto run the code even when it is set on auto run. Is this a bug or just a way to break into a locked up controller?
What is the best way to start the script during testing.
Please Log in or Create an account to join the conversation.
- Michael Burton
- Topic Author
- Offline
Less
More
- Posts: 64
- Thank you received: 1
12 years 7 months ago #29525399
by Michael Burton
Replied by Michael Burton on topic Re:sdc2130
Can I write to the _var and is so what is the command and syntax I do not see it in the reference material. I can see how to read the user var but not how to write it.
Am I correct to assume that it be persistent after restart?
Am I correct to assume that it be persistent after restart?
Please Log in or Create an account to join the conversation.
- roboteq
12 years 7 months ago #29525401
by roboteq
Replied by roboteq on topic Re:sdc2130
VAT is a way for you to send an value via serial/USB and have the script read it for any purpose. This value can be updated by the script and read from serial.
Syntax is !VAR 12345 to write and ?VAR to read
Syntax is !VAR 12345 to write and ?VAR to read
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
Time to create page: 0.076 seconds