"Real-time control software Design" the second programming job

Source: Internet
Author: User

The second programming job, in order to achieve our robot coffee corner, we will construct a two-axis planar robot based on the rotation of the first operation, the motion principle see animation
Requirements:
1) The code includes at least two classes: A robot class and a Solver class, the robot class defines the length of each arm, the angle of rotation of each joint and 0 points, and the Solver Solver class is used to realize the inverse kinematics transformation of the robot, The positive kinematics transforms the joint coordinates of the robot into Cartesian coordinates, and the inverse kinematics transforms the Cartesian coordinates of the robot into joint coordinates.
2) define the coordinate system class: The robot's origin is the world coordinate system, and allows the user to define the workpiece coordinate system or the Task coordinate system (task frame), and there is an offset and rotation relationship between the task coordinate system and the world coordinate system. The angular values of each joint of the robot form the joint coordinate system (Joint Frame).
3) Each robot allows you to define any number of task coordinate systems, use the vector container to implement this function.
4) The robot object receives the PTP (Point-to-point) movement instruction from the user, the coordinate value given by the instruction is either the joint coordinate system or the world coordinate system or the task coordinate system, and the robot transforms the world coordinate value and the task coordinate value into joint coordinates and updates the joint angle value through the Solver Solver class.
Note: In this programming does not need the robot to have the continuous trajectory movement function, only need to be able to according to the user's PTP instruction directly to the internal joint angle value Update can be.
5) test the main program architecture as follows:

int main ()
{
Create a Robot object Myrobot, initialize the robot's mechanical parameters, the joint coordinate system (JF), the World coordinate system (WF).
Create 3 task coordinate systems for robot objects TF1, TF2, TF3.
Control the movement of robot objects in different coordinate systems, such as:
Myrobot.ptpmove (JF,P1);
Myrobot.ptpmove (WF,P2);
Myrobot.ptpmove (TF1,P3);
Myrobot.ptpmove (TF2,P4);
Myrobot.ptpmove (TF3,P5);
}

#include <iostream>#include<vector>#include<algorithm>using namespacestd;classpoint{ Public: Point () {x=0; Y=0; } Point (DoubleXDoubley) { This->x =x;  This->y =y; }Private:    Doublex; Doubley;};classline{ Public: Line (point start, point end) { This->start =start;  This->end =end; }Private: Point start; Point end;};classsolver{};classframe{ Public: Frame () {Delta_theta=0; Delta_x=0; Delta_y=0; } Frame (DoubleDelta_theta,DoubleDelta_x,Doubledelta_y) {         This->delta_theta =Delta_theta;  This->delta_x =delta_x;  This->delta_x =delta_x; }Private:    DoubleDelta_theta; Doubledelta_x; Doubledelta_y;};classrobot{ Public: Vector<Frame>TaskFrame; Robot () {ArmLength1=5; ArmLength2=5; } Robot (DoubleArmLength1,DoubleArmlength2) {         This->armlength1 =ArmLength1;  This->armlength2 =Armlength2; }    voidPtpmove (point start, point end) {}Private: Frame worldframe;    Frame Jointframe; DoubleArmLength1; DoubleArmLength2;};intMain () {//Create a Robot object Myrobot, initialize the robot's mechanical parameters, the joint coordinate system (JF), the World coordinate system (WF). //Create 3 task coordinate systems for robot objects TF1, TF2, TF3. //control the movement of robot objects in different coordinate systems, such as://Myrobot.ptpmove (JF,P1); //Myrobot.ptpmove (WF,P2); //Myrobot.ptpmove (TF1,P3); //Myrobot.ptpmove (TF2,P4); //Myrobot.ptpmove (TF3,P5);}

"Real-time control software Design" the second programming job

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.