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

📄 joint.cpp

📁 可以实现PC机与首钢MOTOMAN up6机器人的连接
💻 CPP
字号:
// JOINT.cpp : implementation file
//

#include "stdafx.h"
#include "CTest.h"
#include "JOINT.h"
#include <direct.h>
#include "motocom.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CJOINT dialog
extern short  nCid;  //通讯句柄
       double speed;   //运动速度
       double Setpulse[6];  //设置各轴位置脉冲
       double Getpulse[6];
 //      double GetPos[6];    //获取位置姿态
extern unsigned short Form,*rconf;  //机器人形式

CJOINT::CJOINT(CWnd* pParent /*=NULL*/)
	: CDialog(CJOINT::IDD, pParent)
{
	//{{AFX_DATA_INIT(CJOINT)
	m_speed = 10.0;
	m_joint = 2000.0;
	//}}AFX_DATA_INIT
}


void CJOINT::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CJOINT)
	DDX_Text(pDX, IDC_SPEED, m_speed);
	DDV_MinMaxDouble(pDX, m_speed, 0., 100.);
	DDX_Text(pDX, IDC_JOINT, m_joint);
	DDV_MinMaxDouble(pDX, m_joint, 0., 200000.);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CJOINT, CDialog)
	//{{AFX_MSG_MAP(CJOINT)
	ON_BN_CLICKED(IDC_SAXISPULSE, OnSaxispulse)
	ON_BN_CLICKED(IDC_RSAXISPULSE, OnRsaxispulse)
	ON_BN_CLICKED(IDC_LAXISPULSE, OnLaxispulse)
	ON_BN_CLICKED(IDC_RLAXISPULSE, OnRlaxispulse)
	ON_BN_CLICKED(IDC_UAXISPULSE, OnUaxispulse)
	ON_BN_CLICKED(IDC_RUAXISPULSE, OnRuaxispulse)
	ON_BN_CLICKED(IDC_RAXISPULSE, OnRaxispulse)
	ON_BN_CLICKED(IDC_RRAXISPULSE, OnRraxispulse)
	ON_BN_CLICKED(IDC_BAXISPULSE, OnBaxispulse)
	ON_BN_CLICKED(IDC_RBAXISPULSE, OnRbaxispulse)
	ON_BN_CLICKED(IDC_TAXISPULSE, OnTaxispulse)
	ON_BN_CLICKED(IDC_RTAXISPULSE, OnRtaxispulse)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CJOINT message handlers

void CJOINT::OnSaxispulse() 
{
	// TODO: Add your control notification handler code here   
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]-m_joint; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnRsaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]+m_joint; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnLaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]-m_joint; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnRlaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]+m_joint; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnUaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]-m_joint; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnRuaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]+m_joint; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnRaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]-m_joint; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnRraxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]+m_joint; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnBaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]-m_joint; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnRbaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]+m_joint; 
      Setpulse[5]=Getpulse[5]; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnTaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]-m_joint; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

void CJOINT::OnRtaxispulse() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  BscIsLoc(nCid,1,rconf,Getpulse);
      Setpulse[0]=Getpulse[0]; 
      Setpulse[1]=Getpulse[1]; 
	  Setpulse[2]=Getpulse[2]; 
      Setpulse[3]=Getpulse[3]; 
      Setpulse[4]=Getpulse[4]; 
      Setpulse[5]=Getpulse[5]+m_joint; 
      BscPMovj(nCid,m_speed,0,Setpulse);
}

⌨️ 快捷键说明

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