Run GladeVCP from halrun
This is the code in my start.hal file so far
loadusr -Wn gladevcp gladevcp -c gladevcp wd.glade
loadrt threads name1=fast period1=50000 fp1=0 name2=slow period2=1000000
loadrt stepgen step_type=0,0 ctrl_type=v,v
addf stepgen.update-freq slow
addf stepgen.make-pulses fast
setp stepgen.0.position-scale 10000
setp stepgen.0.enable 1
start
Ok the stepgens fire up but the spinbox in my control the up and down arrow keys are disabled. Does this have to do with the handler.py that I've not used yet?
John
Please Log in or Create an account to join the conversation.
The spin button sets the velocity command for the stepgen and the start toggle enables the stepgen... read carefully the GladeVCP manual on the spin box!
The only thing I've not figured out is how to shut down hal when the window is closed but I bet someone knows how... also look at my Glade/Python tutorial 4 for the calculate code to do your scale.
John
Please Log in or Create an account to join the conversation.
Also, I think I found a typo in the python file:
def on_start_button_toggled(self, wedget, data=None):
print "on_start_button_toggled"
I think that should be "widget" instead of "wedget". I'll change that, but it seemed to run ok as is. I'm gonna play with this tonight and tomorrow and see what I can do with it.
Thanks again for the work.
Please Log in or Create an account to join the conversation.
OK, I understand things much better now - I don't think there's any way I could have gotten this far without your help. This is how I interpret everything so far:
Command line:
"halrun -I -f start.hal" - this starts the Hal module (as denoted by "halcmd:" prompt in the console window). Then "-f" pulls in the start.hal file and executes those Hal commands.
start.hal file:
"loaduser" loads gladevcp, then executes the python file and loads the glade panel "wd".
Below that, you create the two threads in realtime environment, create the two stepgens (type 0) and then update the stepgens and set the scale.
Then enable the two hal_hboxes in the glade panel so the controls are visible and accessible.
Then you connect the floating-point output pin of the spinbox to the stepgen velocity input pin.
Then you connect the bit output of the Hal start_button to the stepgen enable pin which starts the stepgen.
handler.py file:
This file contains the methods for handling events
So, now I understand how you are passing the value of the spinbutton to the stepgen. I'll look at your calc tutorial to see how to do the ratio calculation. Also, it looks like the Halcmd "unload all" would unload all the currently running real-time modules, but as you said, I don't know where you would place the command so that it is executed when the window closes.
The last thing I'm not clear on - how do I connect the output of the stepgen to the parallel port to run the motors? But, I'll keep reading the docs and see if I can find out. The HAL Manual stops short in the example it has before they discuss how to tie the output of the stepgen to the parallel port.
Anyway, this is great stuff. It's amazing how much this helps me understand things. Great Job!
Please Log in or Create an account to join the conversation.
- Michael
Please Log in or Create an account to join the conversation.
The last thing I'm not clear on - how do I connect the output of the stepgen to the parallel port to run the motors? But, I'll keep reading the docs and see if I can find out. The HAL Manual stops short in the example it has before they discuss how to tie the output of the stepgen to the parallel port.
If you look in the first Glade/Python tutorial at the destroy part and add the hal unload that should take care of that part.
The connections from the stepgen to the parallel port are just more net commands like the following.
net spool-step parport.0.pin-02-out <= stepgen.0.step
When you start your config in the terminal type in show pin and show param to see the pins and parameters.
John
Please Log in or Create an account to join the conversation.
the spinbutton widget is a bit awkward to get right in glade, which is why there is an example in configs/gladevcp/by-widget/spinbutton .
- Michael
I don't see that directory when I use the installed 2.5 config picker from the menu... but I see them in the git repo. There must be some kind of bug in the config picker.
John
Please Log in or Create an account to join the conversation.
....
Also, I think I found a typo in the python file:
...
I think that should be "widget" instead of "wedget". I'll change that, but it seemed to run ok as is. I'm gonna play with this tonight and tomorrow and see what I can do with it.
...
I think BigJohnT was already focusing on lunch, so it is kindof natural potato wedges get in the way.
-m
Please Log in or Create an account to join the conversation.
mhaberler wrote:
the spinbutton widget is a bit awkward to get right in glade, which is why there is an example in configs/gladevcp/by-widget/spinbutton .
- Michael
I don't see that directory when I use the installed 2.5 config picker from the menu... but I see them in the git repo. There must be some kind of bug in the config picker.
John
I have no good understanding what the config picker does, but at least configs/gladevcp/by-widget/spinbutton is in 2.5
probably the stuff under configs/gladevcp needs to be separated into examples and pickable configs.
Many moons ago I have proposed an example directory, but the timeout on my idea suggested the consensus opinion is "example directories are for whimps" , so that's where it wound up.
-m
Please Log in or Create an account to join the conversation.
Perhaps you should take the approach that any suggestion which is not actively veto-ed is accepted?Many moons ago I have proposed an example directory, but the timeout on my idea suggested the consensus opinion is "example directories are for whimps"
Please Log in or Create an account to join the conversation.