Re: Action to manually drive the robot ** Re: Keyboard input.

Re: Action to manually drive the robot

You can just use ArActionKeydrive, it already does exactly these
things... ArKeyHandler does the keyboard input too, if you want to
just use that straight up or see how to do it... basically getc is a
blocking command or waits for enter or something along those
lines... so you have to do some termios stuff to set it up right in
Linux and check 'kbhit' in Windows.

You should upgrae to the latest version for this... I only put this in
in release like 1.0.2 or so.

Matt LaFary
ActivMedia Robotics

On Thu, Mar 21, 2002 at 12:23:50PM -0500, Laurel D. Riek wrote:
> Hi,
>
>          So, I wrote an action to manually drive the robot via the
> keyboard, using getchar. However,
> I noticed 1) there was a lot of lag, 2) my actions were not always
> immediately accepted by the program, and 3) the entire system would often
> lock up
>          Should this be a user task instead of an action? Is there
> something I should use instead of getchar?
>
> Thanks,
> Laurel

2 Re: Keyboard input.

If you set this up right you shouldn't have any problems... check out
the demo that comes with the latest ARIA, it'll control gripper,
camera, everthing (one mode at once though)... 

I'm taking a stab at how you're using things here... if this isn't how
you're using things then just describe how you're using them and we'll
sort it out.  Since you're using a user task I gather you're calling
getKey, which you're right in saying you shouldn't mix with an
ArActionKeyDrive...  The right way to do this is to give some functors
to the ArKeyHandler that is already set up by ArActionKeyDrive, or to
make a key handler and populate it with your own functors before you
addAction your keydrive action.  To add functors make or use an
existing key handler like so:

ArKeyHandler *keyHandler;
if ((keyHandler = Aria::getKeyHandler()) == NULL)
{
    keyHandler = new ArKeyHandler;
    Aria::setKeyHandler(keyHandler);
    if (myRobot != NULL)
      myRobot->attachKeyHandler(keyHandler);
    else
      ArLog::log(ArLog::Terse, "ArMode: No robot to attach a keyHandler to");
}
keyHandler->addKeyHandler('z', someFunctor);

I have just modified the comments about getKey a little, so that if
the docs note its internal and what functions to use... I didn't make
getKeys protected because I can see cases where someone would want to
take care of the keyhandling and such themselves... but I added
comments (documentation) clarifying.

And again, if I described a method you aren't using and you are
already using this method describe in a little more detail what you're
doing and we'll sort out the trouble.

Matt LaFary
ActivMedia Robotics

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值