⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zhangzhiguangview.h

📁 用势场法的原理实现的vc搜索最短路径程序
💻 H
字号:
// zhangzhiguangView.h : interface of the CZhangzhiguangView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_ZHANGZHIGUANGVIEW_H__676C6B58_6EB9_44CC_9C09_3EC7EA978928__INCLUDED_)
#define AFX_ZHANGZHIGUANGVIEW_H__676C6B58_6EB9_44CC_9C09_3EC7EA978928__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//——————————基本常数参数的定义——————————//
#define Full_Screen_Width  707       //运动区域的宽度和高度
#define Full_Screen_Height 440
#define Pixel_Per_Meter    5         //每米有多少象素点
#define Avoid_Collide_threshold 2    //把机器人当作质点处理
#define Sensor_Detect_Threshold 5    //§传感器最大探测距离为5米,可调节看不同的效果。探测距离越大,
        //§越容易发生死点,可知在宏观上影响因素越多,越难作出合适的决策;微观上则表现为合力容易在还没目标时达到零。
        //§在樊老师的程序中也没有处理同时避两个障碍物的情况,因为这样较难穿过去。
        //§需要找最优的方法为:既能考虑传感器的探测距离尽可能的远,以避免走多余的路程,又能想办法能从两个障碍物中间穿过去,
        //§只要两个物体之间的距离大于机器人本身的尺寸。
        //§1,此法正在考虑中,可以先查查相关方面的资料!
        //§2,首先需要证明在两个物体作用机器人时,加上目标的作用,合力是否一定会收敛到零?还是零点处有一定范围的吸引域?
        //§3,当合力为零时,要怎样给它加干扰才合适?因为在下面程序中加干扰的方式好像效果不是很明显。
#define Robot_Move_Speed 1           //速度1m/s,且认为是定值

#define Sensor_Max_Range Sensor_Detect_Threshold*Pixel_Per_Meter
#define Protect_Distance Avoid_Collide_Threshold*Pixel_Per_Meter
#define Robot_Speed Robot_Move_Speed*Pixel_Per_Meter

#define Orig_Pos_x 50                //起始点和终点的坐标
#define Orig_Pos_y 450
#define Goal_Pos_x 440
#define Goal_Pos_y 75
/*   --------------------------------改成用结构定义
#define Obstacle_1_x 130             //障碍物的圆心坐标
#define Obstacle_1_y 130
#define Obstacle_2_x 260
#define Obstacle_2_y 260
#define Obstacle_3_x 400
#define Obstacle_3_y 360

#define Obstacle_1_R 40              //障碍物的半径
#define Obstacle_2_R 40
#define Obstacle_3_R 30              */
//—————————————————————————————//

class CZhangzhiguangView : public CFormView
{
protected: // create from serialization only
	CZhangzhiguangView();
	DECLARE_DYNCREATE(CZhangzhiguangView)

public:
	//{{AFX_DATA(CZhangzhiguangView)
	enum { IDD = IDD_ZHANGZHIGUANG_FORM };
	CProgressCtrl	m_Progress;
	CListBox	m_Y;
	CListBox	m_X;
	//}}AFX_DATA

// Attributes
public:
	CZhangzhiguangDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CZhangzhiguangView)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnDraw(CDC* pDC);
	//}}AFX_VIRTUAL

// Implementation
public:
	int Mid_Pos_y;
	int Mid_Pos_x;
	double fGoalForce_y;
	double fGoalForce_x;
	double ObstacleGain;
	double GoalGain;
	struct Obstacle_Coor_R
	{
		int Obstacle_x;
		int Obstacle_y;
		int Obstacle_R;
		double Force_Obs_x;
		double Force_Obs_y;
	}Obstacle[5];
//	struct Obstacle_Coor_R Obstacle[3];//={{130,130,40,0.0,0.0},{260,260,40,0.0,0.0},{400,360,30,0.0,0.0}};
	bool Force_Goal(int fMid_Pos_x,int fMid_Pos_y);
	void Force_Obstacle(int fMid_Pos_x,int fMid_Pos_y,struct Obstacle_Coor_R *PointerObstacle);
	int temp2;
	int temp1;
	void BeginDrawRobot(CClientDC *pDC);
	double route_x;
	double route_y;
	int which_method;
/*	typedef struct  
	{
		int Obstacle_x;
		int Obstacle_y;
		int Obstacle_R;
		double Force_Obs_x;
		double Force_Obs_y;
	}Obstacle_Coor_R;
	Obstacle_Coor_R *Obstacle;*/
	

	virtual ~CZhangzhiguangView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CZhangzhiguangView)
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnRengongshichang();
	afx_msg void OnShenjingwangluo();
	afx_msg void OnBegintocompute();
	afx_msg void OnStopcomputing();
	afx_msg void OnTimer(UINT nIDEvent);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in zhangzhiguangView.cpp
inline CZhangzhiguangDoc* CZhangzhiguangView::GetDocument()
   { return (CZhangzhiguangDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_ZHANGZHIGUANGVIEW_H__676C6B58_6EB9_44CC_9C09_3EC7EA978928__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -