📄 robot.h
字号:
//////////////////////////////////////////////////////////////////////
// MuRoS - Multi Robot Simulator
//
// Luiz Chaimowicz
// GRASP Lab. University of Pennsylvania
// VERLab - DCC - UFMG - Brasil
//
// Robot.h : header file
//
///////////////////////////////////////////////////////////////////////
#if !defined(ROBOT_H)
#define ROBOT_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Afxtempl.h"
#include "DataMsg.h"
#include "ControlMsg.h"
#include "ObstacleInfo.h"
#include "MapPath.h"
#include "MapView.h"
// windows messages
#define WM_DATAMSG WM_USER + 10
#define WM_CONTROLMSG WM_USER + 11
#define WM_TESTEMSG WM_USER + 12
#define WM_DATAMSGBUFFER WM_USER + 13
#define WM_CONTROLMSGBUFFER WM_USER + 14
// robot states (m_status)
#define LEAD 1
#define FOLLOW 2
#define DOCK 3
#define WAIT 4
#define PUSH 5
#define ERRO 6
#define BACKUP 7
#define TRANSPORT 8
#define ESCORT 9
#define STOPPED 10
#define WANDER 11
#define GETITEM 12
#define FPPATH 13
#define GOPOSITION 14
// control messages
#define LPASS 1
#define DOCKOK 2
#define LCHANGE 3
#define POOL 4
#define PUSHOK 5
#define BACKUPMSG 6
#define NEWLEADER 7
#define BOXLOCKED 8
#define NEWROBOT 9
#define LOSTBOX 10
#define TIMEOUT 11
#define NEWPOINT 12
#define WILLGET 13
#define GOFORIT 14
#define DELETEROBOT 15
class CBox;
/////////////////////////////////////////////////////////////////////////////
// CRobot window
class CRobot : public CWnd
{
DECLARE_SERIAL(CRobot)
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRobot)
//}}AFX_VIRTUAL
// Generated message map functions
protected:
//{{AFX_MSG(CRobot)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
virtual afx_msg LRESULT OnControlMsg(WPARAM wParam, LPARAM lParam);
virtual afx_msg LRESULT OnDataMsg(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
public:
CRobot();
CRobot(double x, double y, double theta, short status, short id, CString Name);
virtual ~CRobot();
virtual void Serialize(CArchive& archive );
virtual void Draw(CDC* pDC);
virtual void Update(CArray<CRobot*, CRobot*> *robots, double simTime, double dt, CBox *Box, CMapPath *mapPath);
virtual void Output(double simTime);
virtual void ForceFromObstacles(CObstacle *obst, double &fx, double &fy);
virtual void ForceFromBoxes(CBox *box, double &fx, double &fy);
virtual void ForceOnBoxes(CBox *box,double &fx, double &fy, double &ftheta);
virtual void ForceFromRobots(CRobot *robot, double &fx, double &fy);
virtual void SetOrientation(double angle);
virtual CString GetInfo();
void SendControlMsg(CControlMsg *msg);
void PostControlMsg(CControlMsg *msg);
void SendDataMsg(CDataMsg *msg);
void Sensor(CMapPath *globalMap, CBox *box);
virtual short DetectObstacles(CObstacle *obst, BOOL Erased);
virtual void DetectBox(CBox *box);
void CloseOutput();
void OpenOutput();
void DeleteContents();
short m_controlMsgCount; // count the number of control messages received by the robot
short m_status; // current robot state
short m_id; // robot id (set when the robot is created)
CString m_name; // robot "name" (for display and file output purposes)
short m_leader; // current leader (in a leader follower architecture)
short m_numRobots; // size of the robot team (each robot keeps track of the total number of robots)
double m_x; // robot pose
double m_y;
double m_theta;
double m_radius; // robot radius
CRect m_rect; // robot outside rectangle
short m_controlType; // Variables for the leader-follower 'bicycle controller)
double m_beta;
double m_r;
double m_timer; // timer to compute timeouts
short m_sensorRange; // range of sensor
short m_numObstacles; // number of obstacle currently detected
BOOL m_inContactBox; // True if in contact with the box
CPoint m_contactPoint; // contact point if the box
double m_distBox; // distance to the box
double m_angleBox; // angle to the box
CMapPath *m_localMap; // map
CMapView m_localView; // window to show the map
CArray<CPoint, CPoint> m_path; // keeps track of the robot trajectory for displaying
protected:
FILE * m_out; // output file (***** need to change to a stream object)
};
#include "Box.h"
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -