Return to manual mode after MDI command

More
19 Jan 2013 14:10 #28814 by Miselph
Hey Folks,

I have a glade panel which contains buttons which send MDI commands. The commands execute correctly but leave the machine in joint mode rather than telop mode. Is there a way of setting the mode back to telop after an mdi command has been run?

Thanks.

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

More
19 Jan 2013 14:25 #28815 by mhaberler
are you using the Action widgets for MDI?

-m

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

More
20 Jan 2013 11:57 #28852 by Miselph
Yes I am. I am using the toggle button linked to the MDI action toggle widget.
I am thinking that the solution may lie with a custom callback, but I am not sure where to start.

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

More
20 Jan 2013 15:00 #28857 by Miselph
So, I had a fiddle around. I couldn't figure out how to change a hal pin from gladevcp so I did it using a system call to halcmd

Here is my code, now tell me how wrong it is :silly:
from subprocess import call
from time import sleep

class PanelHandlers:

    def reset_manual_and_teleop(args1,args2):
        call(["halcmd", "setp", "halui.mode.manual", "1"])
        call(["halcmd", "setp", "halui.mode.teleop",  "1"])
        sleep(1)
        call(["halcmd", "setp", "halui.mode.manual", "0"])
        call(["halcmd", "setp", "halui.mode.teleop", "0"])
    
def get_handlers(halcomp,builder,useropts):
    return [PanelHandlers()]

I suspect that this is a non-optimal approach, but it does seem to work.

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

Moderators: HansU
Time to create page: 0.119 seconds
Powered by Kunena Forum