Skip to content

Conversation

@yaojinrun
Copy link
Contributor

2.kinematics_get_rpm函数中动态申请内存后并没有释放,会造成内存消耗。作为存储转换后的rpm值只需要申请一次后可重复使用,故移动到了kinematics_create函数中。
2.kinematics_get_rpm和kinematics_get_velocity函数中circumference替换wheel_radius即可修正计算错误的问题。
3.api.md文档中wheel_radius的值实际作为半径计算的。

2.kinematics_get_rpm函数中动态申请内存后并没有释放,会造成内存消耗。作为存储转换后的rpm值只需要申请一次后可重复使用,故移动到了kinematics_create函数中。
2.kinematics_get_rpm和kinematics_get_velocity函数中circumference替换wheel_radius即可修正计算错误的问题。
3.api.md文档中wheel_radius的值实际作为半径计算的。
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;
Copy link
Collaborator

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

关于这块 函数的输出 是以返回值的形式(也应该返回结构体)还是指针参数 我是倾向于后者的


#define PI 3.1415926f

static rt_int16_t* res_rpm;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个全局指针不合适, 真要采取函数返回值的形式的话, 仿照之前的kinematics_get_velocity 返回结构体就好了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你说这个全局指针不合适,我没太明白,可以说的详细点吗?

@sogwms
Copy link
Collaborator

sogwms commented Dec 4, 2019

建议分开提交, 你的标题和提交的内容不太一致啊, circumference确实是bug修复

@yaojinrun
Copy link
Contributor Author

好的,晚点重新提交

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants