-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming interface, adding basic kinematics
- Loading branch information
1 parent
ddd6f93
commit c1000b3
Showing
14 changed files
with
220 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cc_library( | ||
name = "generic_kinematics_lib", | ||
hdrs = [ | ||
"ikinematics.h", | ||
], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//src/math:vector_lib", | ||
"//src/robot/actuator:generic_motor_lib", | ||
"@eigen", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include "src/math/vector_math.h" | ||
#include "src/robot/actuator/imotor.h" | ||
#include <Eigen/Eigen> | ||
|
||
class IKinematics { | ||
public: | ||
/** | ||
* @brief Forward kinematics uses the position of actuators and/or | ||
* sensors on the robot, to determine the overall position of the | ||
* robot. | ||
* | ||
* @return true | ||
* @return false | ||
*/ | ||
virtual bool CalculateForwardKinematics(int dT, Location *out_location, | ||
Eigen::Rotation2Df *out_rotation) = 0; | ||
|
||
virtual bool | ||
CalculateInverseKinematics(int dT, Movement desired_movement, | ||
std::vector<IMotor *> motor_list, ) = 0; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#pragma once | ||
|
||
struct PIDGain { | ||
float kP; | ||
float kI; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
cc_library( | ||
name = "generic_motor_lib", | ||
hdrs = [ | ||
"motor.h", | ||
"imotor.h", | ||
], | ||
deps = [ | ||
"//src/math:math_lib", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#pragma once | ||
|
||
#include "src/math/pid.h" | ||
#include "src/math/vector_math.h" | ||
#include <Eigen/Eigen> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#pragma once | ||
|
||
#include "src/robot/actuator/dynamixel_motor.h" | ||
#include <Eigen/Eigen> | ||
|
||
class Robot { | ||
private: | ||
std::vector<DynamixelMotor> motor_list_; | ||
// We need to use pointers to allow polymorphism to work. We | ||
// cannot have a vector of references to an abstract class, as | ||
// an abstract class itself can never be instantiated. | ||
std::vector<IMotor *> motor_list_; | ||
|
||
public: | ||
Robot(std::vector<DynamixelMotor> motor_list); | ||
Robot(std::vector<IMotor *> motor_list); | ||
|
||
bool SetSpeed(Eigen::Vector2d unit_speed, Eigen::Rotation2Df rotation); | ||
}; |