Pioneer-Users

Date Index Thread Index

Re: [Pioneer-users] Question about controlling gripper




Hello,


Tao Zhang wrote:
> Hi Reed,
> 
> I was trying to modify the code of guiServer.cpp. I suspect the following code is related to adding custom commands into MobileEyes.
> 
> // Add some simple (custom) commands for testing and debugging:
>   ArServerSimpleComUC uCCommands(&commands, &robot);                   // Send any command to the microcontroller.
...

> But I could figure out how to add commands of gripper control like this. Could you give me an example or what classes should I know? I guess I haven't got a clear view of all the objects and their relations. Thank you very much!


Use the ArServerHandlerCommands object called 'commands', and use its 
addCommand() method to add whatever commands you need.

For example,

commands.addCommand("GripperClose", "Close the gripper", new ArRetFunctorC<bool, 
ArGripper>(&gripper, ArGripper::gripClose));

Where 'gripper' is an ArGripper object.  Then the command "GripperClose" should 
appear in MobileEye's list of custom commands, and when 'commands' receives that 
command, it will call gripper.gripClose().

If you want you can write a class to encapsulate those addCommand() calls, and 
any methods you need to write to use as callbacks if for whatever reason you 
can't use the ArGripper methods directly -- this is what those other 
ArServerSimple... classes are that you see used in guiServer.

Reed