ARIA-Users
Date Index
Thread Index
[Aria-users] when defined ArServerBase, can ArAction still works
- To: aria-users <aria-users@xxxxxxxxxxxxxxxx>
- Subject: [Aria-users] when defined ArServerBase, can ArAction still works
- From: wjxnet_126 <wjxnet_126@xxxxxxx>
- Date: Mon, 26 May 2008 22:27:00 +0800 (CST)
- Content-Type: multipart/alternative; boundary="----=_Part_118867_31832470.1211812020930"
- Delivered-To: aria-archives@activmedia.com
- Delivered-To: aria-users@server.local.net
- Resent-Date: Mon, 26 May 2008 11:30:55 -0400 (EDT)
- Resent-From: aria-users@xxxxxxxxxxxxxx
- Resent-Message-ID: <1EU6Q.A.3y.uetOIB@server.activmedia.com>
- Resent-Reply-To: aria-users@activmedia.com
- Resent-Sender: aria-users-request@xxxxxxxxxxxxxx
hello,
i wrote a code to let a robot run in some particular way, and send its status to a client. In this robot's project, i made a class to let the robot do some action,
class fileMode:public ArAction
{
public:
// Constructor
fileMode(ArRobot *robot,ArTime *actionStart);
// Destructor
virtual ~fileMode(void);
// The action
virtual ArActionDesired *fire(ArActionDesired currentDesired);
// sets the robot pointer, also gets the sonar device, or deactivates this action if there is no sonar.
virtual void setRobot(ArRobot *robot);
protected:
ArActionDesired myDesired;
ArRobot *myRobot;
RobotTrace runnerTrace[RobotTraceNum];
};
ArActionDesired *fileMode::fire(ArActionDesired currentDesired)
{
// Reset the desired action
myDesired.reset();
myDesired.setHeading(runnerTrace[i].Th);
myDesired.setVel(runnerTrace[i]Vel);
return &myDesired;
}
in the main() function, i have
ArServerBase server;
and some parts to do ArNetworking,
then
ArRobot robot;
fileMode myFileMode(&robot, &actionStart);
robot.addAction(&myFileMode,60);
robot.runAsync(true);
server.runAsync();
but the robot just does not do the fileMode action, could you please tell me the reason. Anyhow, if in main(), i just write
robot.move(2000), then the robot do move, but the obstacle avoidness mechanism does not work, though i have
ArActionLimiterForwards limiter("speed limiter near", 300, 600, 100);
ArActionLimiterForwards limiterFar("speed limiter far", 300, 1100, 300);
ArActionLimiterBackwards backwardsLimiter;
ArActionConstantVelocity stop("stop", 0);
ArActionConstantVelocity backup("backup", -200);
ArActionStallRecover recover;
// Add the actions to the robot in descending order of importance.
robot.addAction(&recover, 100);
robot.addAction(&limiter, 95);
robot.addAction(&limiterFar, 90);
robot.addAction(&backwardsLimiter, 80);
robot.addAction(&backup, 50);
robot.addAction(&stop, 10);
Thanks!
Jianxin Wu
伊利525健康中国公益日