Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

From student resources and discussion notes, create a math object that calculates the two angles needed to move arm to (x,y). 1. use a class

From student resources and discussion notes, create a math object that calculates the two angles needed to move arm to (x,y).

1. use a class object

2. use a point object and angle object.

3. (x,y) supplied, (l1, l2) arm lengths supplied, angles returned.

S

#include "RoboMath.h"

#include

RoboMath::RoboMath(double A1, double A2)

{

Arm1 = A1;

Arm2 = A2;

}

double RoboMath::GetAngle1()

{

return asin((Arm2 * sin(GetAngle2())) /

(sqrt(pow( xy.X,2)+pow( xy.Y,2))))

+ atan(xy.Y/xy.X);

}

double RoboMath::GetAngle2()

{

return acos(( pow( xy.X,2) + pow( xy.Y,2)-

(Arm1*Arm1)-(Arm2*Arm2))/(2*Arm1*Arm2));

}

AnglePair RoboMath::RoboMove(PointXY XYPos){

AnglePair Temp;

xy.X = XYPos.X;

xy.Y = XYPos.Y;

Temp.Ang1 = GetAngle1();

Temp.Ang2 = GetAngle2();

return Temp;

}

tarting point:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions