实时控制软件设计第二次作业
1-1、Point.h
#ifndef _POINT_H_
#define _POINT_H_
class Point{
private:
double _x;
double _y;
public:
Point(double x,double y);
double getX();
double getY();
};
#endif
1-2、Point.cpp
#include"Point.h"
#include<iostream>
Point::Point(double x,double y)
{this->_x=x;
this->_y=y;}
double Point::getX()
{return this->_x;}
double Point::getY()
{return this->_y;}
2-1、Frame.h
#include<cmath>
#include<Eigen/Dense>
#include"Point.h"
using namespace std;
class Frame{
private:
Point P0;
double Degree;
public:
Frame(){}
Frame(Point P1,double degree){
P0=P1;
Degree=degree;}
Point getPoint(){return P0;}
double getDegree(){return Degree;}
};
#endif
3-1、JointFrame.h
#ifndef _JOINTFRAME_H_
#define _JOINTFRAME_H_
#include"Frame.h"
class JointFrame{
private:
double JointDegree[2];
public:
JointFrame();
JointFrame(double degree1,double degree2);
double setDeg(double degree1,double degree2);
double getDeg1();
double getDeg2();
};
#endif
3-2、JointFrame.cpp
#include "JointFrame.h"
JointFrame::JointFrame(){JointDegree[0]=0;
JointDegree[1]=0;}
JointFrame::JointFrame(double degree1,double degree2){
JointDegree[0]=degree1;
JointDegree[1]=degree2;}
double JointFrame::setDeg(double degree1,double degree2){
JointDegree[0]=degree1;
JointDegree[1]=degree2;}
double JointFrame::getDeg1(){return JointDegree[0];}
double JointFrame::getDeg2(){return JointDegree[1];}
4-1、Solver.h
#ifndef _SOLVER_H_
#define _SOLVER_H_
#define PI=3.14159
#include<cmath>
#include"Point.h"
#include"Frame.h"
#include"JointFrame.h"
class Solver{
private:
JointFrame jointframe;
Frame frame;
public:
Solver(JointFrame jointf,Frame f);
Point move(Point p1,Point P2);
Point rotate(Point p,double deg);
Point FrameWF(Frame f,Point p);
void FrameJF(Point p,double arm1,double arm2);
};
#endif
4-2、solver.cpp
#include"Solver.h"