ARIA-Users

Date Index Thread Index

[Aria-users] when defined ArServerBase, can ArAction still works



 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健康中国公益日