58 std::vector<BoneDefinition>
bones;
69 const std::vector<Bone>&
bones()
const {
return m_bones; }
74 typedef float AngleType;
76 static AngleType
clamp(AngleType ang);
78 Arm(
const Definition& def);
81 template <
typename T = CoordType>
82 static T roundCoord(AngleType val);
85 AngleType rotateArm(
size_t idx, AngleType rot_ang);
86 void fixBodyCollision();
90 const Definition m_def;
91 std::vector<Bone> m_bones;
108 void updatePos(
Bone* prev);
127 BoneBuilder(std::shared_ptr<Arm::BoneDefinition> def);
129 std::shared_ptr<Arm::BoneDefinition> m_def;
141 std::unique_ptr<Arm>
build();
145 std::vector<std::shared_ptr<Arm::BoneDefinition>> m_bones;
Definition: RBControl_angle.hpp:11
static const Angle Pi
Definition: RBControl_angle.hpp:14
Definition: RBControl_arm.hpp:132
ArmBuilder()
Definition: RBControl_arm.cpp:19
ArmBuilder & armOffset(Arm::CoordType x_mm, Arm::CoordType y_mm)
Definition: RBControl_arm.cpp:31
ArmBuilder & body(Arm::CoordType height_mm, Arm::CoordType radius_mm)
Definition: RBControl_arm.cpp:25
~ArmBuilder()
Definition: RBControl_arm.cpp:22
std::unique_ptr< Arm > build()
Definition: RBControl_arm.cpp:43
BoneBuilder bone(uint8_t servo_id, Arm::CoordType length_mm)
Definition: RBControl_arm.cpp:37
Definition: RBControl_arm.hpp:16
void setServos(float speed=180.f)
Definition: RBControl_arm.cpp:131
const Definition & definition() const
Definition: RBControl_arm.hpp:68
bool solve(Arm::CoordType target_x, Arm::CoordType target_y)
Definition: RBControl_arm.cpp:159
bool syncBonesWithServos()
Definition: RBControl_arm.cpp:138
~Arm()
Definition: RBControl_arm.cpp:128
int32_t CoordType
Definition: RBControl_arm.hpp:21
const std::vector< Bone > & bones() const
Definition: RBControl_arm.hpp:69
static Angle clamp(Angle ang)
Definition: RBControl_arm.cpp:116
Definition: RBControl_arm.hpp:113
BoneBuilder & calcAbsAng(std::function< Angle(Angle servoAng)> func)
Definition: RBControl_arm.cpp:86
BoneBuilder & baseRelStops(Angle min, Angle max)
Definition: RBControl_arm.cpp:75
BoneBuilder(BoneBuilder &&other)
Definition: RBControl_arm.cpp:56
BoneBuilder & absStops(Angle min, Angle max)
Definition: RBControl_arm.cpp:69
BoneBuilder & relStops(Angle min, Angle max)
Definition: RBControl_arm.cpp:63
~BoneBuilder()
Definition: RBControl_arm.cpp:60
BoneBuilder & calcServoAng(std::function< Angle(Angle abs, Angle rel)> func)
Definition: RBControl_arm.cpp:81
Definition: RBControl_arm.hpp:94
Arm::CoordType x
Definition: RBControl_arm.hpp:101
Angle servoAng() const
Definition: RBControl_arm.hpp:103
const Arm::BoneDefinition & def
Definition: RBControl_arm.hpp:98
Angle relAngle
Definition: RBControl_arm.hpp:100
Angle absAngle
Definition: RBControl_arm.hpp:100
Arm::CoordType y
Definition: RBControl_arm.hpp:101
The base namespace. Contains some logging functions, too.
Definition: half_duplex_uart.cpp:53
Definition: RBControl_arm.hpp:23
std::function< Angle(Angle)> calcAbsAng
Definition: RBControl_arm.hpp:40
uint8_t servo_id
Definition: RBControl_arm.hpp:33
CoordType length
Definition: RBControl_arm.hpp:34
Angle abs_min
Definition: RBControl_arm.hpp:36
std::function< Angle(Angle, Angle)> calcServoAng
Definition: RBControl_arm.hpp:39
BoneDefinition(uint8_t servo_id, CoordType length)
Definition: RBControl_arm.hpp:24
Angle base_rel_max
Definition: RBControl_arm.hpp:37
Angle rel_min
Definition: RBControl_arm.hpp:35
Angle base_rel_min
Definition: RBControl_arm.hpp:37
Angle abs_max
Definition: RBControl_arm.hpp:36
Angle rel_max
Definition: RBControl_arm.hpp:35
Definition: RBControl_arm.hpp:43
Definition()
Definition: RBControl_arm.hpp:44
CoordType arm_offset_y
Definition: RBControl_arm.hpp:56
CoordType body_radius
Definition: RBControl_arm.hpp:53
std::vector< BoneDefinition > bones
Definition: RBControl_arm.hpp:58
CoordType arm_offset_x
Definition: RBControl_arm.hpp:55
CoordType body_height
Definition: RBControl_arm.hpp:52