#ifndef ARSERVERROBOTINFO_H #define ARSERVERROBOTINFO_H #include "Aria.h" #include "ArServerBase.h" class ArServerClient; /** Server component providing basic robot status information to clients. * This service accepts the following data requests: * * * For bandwidth savings you should use updateNumbers * and updateStrings instead of update. * * The update request returns data regarding the current * state of the robot. * It replies with the following data packet: *
    *
  1. Status (Null-terminated string)
  2. *
  3. Mode (Null-terminated string)
  4. *
  5. Battery voltage (times 10) (2 Byte integer)
  6. *
  7. X position (4 byte floating point number)
  8. *
  9. Y position (4 byte floating point number)
  10. *
  11. Theta (2-byte floating point number)
  12. *
  13. Forward velocity (2-byte integer)
  14. *
  15. Rotation velocity (2-byte integer)
  16. *
* * The updateNumbers request returns data regarding the current * state of the robot. * It replies with the following data packet: *
    *
  1. Battery voltage (times 10) (2 Byte integer)
  2. *
  3. X position (4 byte floating point number)
  4. *
  5. Y position (4 byte floating point number)
  6. *
  7. Theta (2-byte floating point number)
  8. *
  9. Forward velocity (2-byte integer)
  10. *
  11. Rotation velocity (2-byte integer)
  12. *
* * The updateStrings request broadcasts data regarding * the current state of the robot. Request this at -1 to get the * broadcasts and an initial packet with the inital data. * It replies with the following data packet: *
    *
  1. Status (Null-terminated string)
  2. *
  3. Mode (Null-terminated string)
  4. *
* * The physicalInfo request returns data regarding the physical characteristics of * the robot. This information does not change during the robot execution. It replies with the * following data packet: *
    *
  1. Robot type (Null-terminated string)
  2. *
  3. Robot sub-type (Null-terminated string)
  4. *
  5. Robot width in mm (2 byte integer)
  6. *
  7. Robot front length - mm from center of rotation to front of robot (2 byte integer)
  8. *
  9. Robot rear length - mm from center of rotation to back of robot (2 byte integer)
  10. *
* * The batteryInfo request replies with the following data packet: *
    *
  1. Warning voltage (double)
  2. *
  3. Shutdown voltage (double)
  4. *
* * The activityTimeInfo request replies with the following data packet: *
    *
  1. Sec since - the ArServerMode::getActiveModeActivityTimeSecSince value (4-byte int)
  2. *
* * These requests are in the RobotInfo command group. */ class ArServerInfoRobot { public: /// Constructor AREXPORT ArServerInfoRobot(ArServerBase *server, ArRobot *robot); /// Destructor AREXPORT virtual ~ArServerInfoRobot(); /// The function that sends updates about the robot off to the client AREXPORT void update(ArServerClient *client, ArNetPacket *packet); /// The function that sends updates about the robot off to the client AREXPORT void updateNumbers(ArServerClient *client, ArNetPacket *packet); /// The function that sends updates about the robot off to the client AREXPORT void updateStrings(ArServerClient *client, ArNetPacket *packet); /// The function that sends battery info about the robot off to the client AREXPORT void batteryInfo(ArServerClient *client, ArNetPacket *packet); /// The function that sends information about the physical robot AREXPORT void physicalInfo(ArServerClient *client, ArNetPacket *packet); /// The function that sends information about the time that the server mode was last active AREXPORT void activityTimeInfo(ArServerClient *client, ArNetPacket *packet); protected: ArServerBase *myServer; ArRobot *myRobot; void userTask(void); std::string myStatus; std::string myExtendedStatus; std::string myMode; std::string myOldStatus; std::string myOldExtendedStatus; std::string myOldMode; ArFunctor2C myUpdateCB; ArFunctor2C myUpdateNumbersCB; ArFunctor2C myUpdateStringsCB; ArFunctor2C myBatteryInfoCB; ArFunctor2C myPhysicalInfoCB; ArFunctor2C myActivityTimeInfoCB; ArFunctorC myUserTaskCB; }; #endif