-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr6gController.h
50 lines (42 loc) · 1.26 KB
/
r6gController.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Joints.h - Control de articulaciones en robots con motores a paso.
Autor: Alejandro Tevera Ruiz
Contacto: atevera.rz@gmail.com
Lanzada para dominio público en 2020.
*/
#ifndef r6gController_h
#define r6gController_h
#include <Arduino.h>
class Joint
{
private:
int _PDir, _PStep, _Speed;
float _Relation, _Min, _Max, _Old;
bool _Positive;
public:
Joint();
void SetPines(int PDir, int PStep) { _PDir = PDir; _PStep = PStep;}
void SetRelation(float Relation) { _Relation = Relation; }
void SetSpeedRotation(int Speed) { _Speed = Speed; }
void SetPositiveTurn(bool Positive) { _Positive = Positive; }
void SetSoftwareLimits(float Min, float Max) { _Min = Min; _Max = Max; }
void SetInitialAngle(float InitialAngle) { _Old = InitialAngle; }
int DegreesToSteps(float New);
bool CheckSafetyMove(float J);
bool AngularMove(float New, int steps, int count);
void Shutdown();
};
class Robot
{
private:
String _RobotName;
int _EndEffector;
public:
Robot();
String SetRobotName(String Name) { _RobotName = Name; }
String GetRobotName() {return _RobotName;}
int MaxDegrees(int Pulsos[6]);
void InitEndEffector(int EndEffector);
int GetEndEffector() {return _EndEffector;}
};
#endif