-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
684 additions
and
724 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
//---- | ||
// @file leg.h | ||
// @author mask <[email protected]> | ||
// @brief | ||
// @brief | ||
// @version 1.0 | ||
// @date 2023-11-12 | ||
// | ||
// | ||
// @copyright Copyright (c) 2023 | ||
// | ||
// | ||
//---- | ||
|
||
#pragma once | ||
|
||
#include "tim.h" | ||
#include "tmotor.h" | ||
#include "djmotor.h" | ||
#include "datastruct.h" | ||
#include "djmotor.h" | ||
#include "robotparam.h" | ||
#include "tim.h" | ||
#include "tmotor.h" | ||
|
||
typedef struct { | ||
char dir; | ||
DJmotor* wheel; | ||
Tmotor* front; | ||
Tmotor* behind; | ||
Input X, Xd; | ||
Output U; | ||
datastruct angle0; | ||
datastruct L0; | ||
datastruct dis; | ||
u32 timer; | ||
// 五连杆坐标系下的坐标,原点在五连杆的中垂线上 | ||
float angle1, angle2, angle3, angle4; // 角度计算值和读取到的真实值,是和图中的一一对应 | ||
float angle1set, angle4set; // 角度设定值,是在初始角度之上的设定值 | ||
float xa, ya; | ||
float xb, yb; | ||
float xc, yc; | ||
float xd, yd; | ||
float xe, ye; | ||
float Fnow; | ||
float Tpnow; | ||
float TFnow; | ||
float TBnow; | ||
float TWheelnow; | ||
float Fset; // 虚拟力 | ||
float Tpset; // 关节处扭矩 | ||
float TFset; | ||
float TBset; | ||
float TWheelset; | ||
float normalforce; // 地面对机器人的实际支持力 | ||
float K[2][6]; | ||
}Leg; | ||
int dir; | ||
|
||
DJmotor* wheel; | ||
Tmotor* front; | ||
Tmotor* behind; | ||
Input X, Xd; | ||
Output U; | ||
datastruct angle0; | ||
datastruct L0; | ||
datastruct dis; | ||
u32 timer; | ||
// 五连杆坐标系下的坐标,原点在五连杆的中垂线上 | ||
float angle1, angle2, angle3, angle4; // 角度计算值和读取到的真实值,是和图中的一一对应 | ||
float angle1set, angle4set; // 角度设定值,是在初始角度之上的设定值 | ||
|
||
float xa, ya; | ||
float xb, yb; | ||
float xc, yc; | ||
float xd, yd; | ||
float xe, ye; | ||
float Fnow; | ||
float Tpnow; | ||
float TFnow; | ||
float TBnow; | ||
float TWheelnow; | ||
float Fset; // 虚拟力 | ||
float Tpset; // 关节处扭矩 | ||
float TFset; | ||
float TBset; | ||
float TWheelset; | ||
float normalforce; // 地面对机器人的实际支持力 | ||
float K[2][6]; | ||
} Leg; | ||
|
||
void legInit(Leg* leg, LegDir dir, DJmotor* wheel, Tmotor* front, Tmotor* behind); | ||
void legInit(Leg* leg, int dir, DJmotor* wheel, Tmotor* front, Tmotor* behind); | ||
void Zjie(Leg* leg, float pitch); | ||
void Njie(Leg* leg, float xc, float yc); | ||
void VMC(Leg* leg); | ||
|
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,37 +1,37 @@ | ||
//---- | ||
// @file robot.h | ||
// @author mask <[email protected]> | ||
// @brief | ||
// @brief | ||
// @version 1.0 | ||
// @date 2023-11-12 | ||
// | ||
// | ||
// @copyright Copyright (c) 2023 | ||
// | ||
// | ||
//---- | ||
|
||
#pragma once | ||
|
||
#include "leg.h" | ||
#include "yesense.h" | ||
typedef struct { | ||
bool flyflag; | ||
Leg legL; | ||
Leg legR; | ||
Leg legVir; | ||
Yesense yesense; | ||
// 以下四个PID输出结果均为力 | ||
PID* yawpid; // 角速度控制 | ||
PID* rollpid; // 翻滚角控制 | ||
PID* splitpid; // 双腿劈叉控制 | ||
PID* L0pid; // 虚拟力的pid 是腿长的控制 | ||
RobotRunMode mode; | ||
|
||
float L0Set; // 设定腿长,也就是当前两条腿的平均腿长 | ||
float xSet; | ||
float vSet; | ||
bool flyflag; | ||
|
||
Leg legL; | ||
Leg legR; | ||
Leg legVir; | ||
Yesense yesense; | ||
|
||
// 以下四个PID输出结果均为力 | ||
PID* yawpid; // 角速度控制 | ||
PID* rollpid; // 翻滚角控制 | ||
PID* splitpid; // 双腿劈叉控制 | ||
PID* L0pid; // 虚拟力的pid 是腿长的控制 | ||
|
||
RobotRunMode mode; | ||
|
||
float L0Set; // 设定腿长,也就是当前两条腿的平均腿长 | ||
float xSet; | ||
float vSet; | ||
} Robot; | ||
|
||
extern Robot* robot; | ||
|
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
Oops, something went wrong.