-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.将结构体中的struct kinematics中的wheel_radius修改为circumference,这种修改更为贴近作者原意。 #38
base: master
Are you sure you want to change the base?
Conversation
2.kinematics_get_rpm函数中动态申请内存后并没有释放,会造成内存消耗。作为存储转换后的rpm值只需要申请一次后可重复使用,故移动到了kinematics_create函数中。 2.kinematics_get_rpm和kinematics_get_velocity函数中circumference替换wheel_radius即可修正计算错误的问题。 3.api.md文档中wheel_radius的值实际作为半径计算的。
@@ -26,32 +30,34 @@ kinematics_t kinematics_create(enum base k_base, float length_x, float length_y, | |||
new_kinematics->k_base = k_base; | |||
new_kinematics->length_x = length_x; | |||
new_kinematics->length_y = length_y; | |||
new_kinematics->wheel_radius = wheel_radius; | |||
new_kinematics->circumference = wheel_radius * 2.0f * PI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对的,这个的确应该修复
void kinematics_get_rpm(struct kinematics kin, struct velocity target_vel, rt_int16_t *rpm); | ||
void kinematics_get_velocity(struct kinematics kin, struct rpm current_rpm, struct velocity *velocity); | ||
rt_int16_t* kinematics_get_rpm(struct kinematics kin, struct velocity target_vel); | ||
struct velocity kinematics_get_velocity(struct kinematics kin, struct rpm current_rpm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
关于这块 函数的输出 是以返回值的形式(也应该返回结构体)还是指针参数 我是倾向于后者的
@@ -14,6 +14,10 @@ | |||
#define DBG_LEVEL DBG_LOG | |||
#include <rtdbg.h> | |||
|
|||
#define PI 3.1415926f | |||
|
|||
static rt_int16_t* res_rpm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个全局指针不合适, 真要采取函数返回值的形式的话, 仿照之前的kinematics_get_velocity 返回结构体就好了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你说这个全局指针不合适,我没太明白,可以说的详细点吗?
建议分开提交, 你的标题和提交的内容不太一致啊, circumference确实是bug修复 |
好的,晚点重新提交 |
2.kinematics_get_rpm函数中动态申请内存后并没有释放,会造成内存消耗。作为存储转换后的rpm值只需要申请一次后可重复使用,故移动到了kinematics_create函数中。
2.kinematics_get_rpm和kinematics_get_velocity函数中circumference替换wheel_radius即可修正计算错误的问题。
3.api.md文档中wheel_radius的值实际作为半径计算的。