Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 6:aad89fd109c2
- Parent:
- 5:6a95726e45b0
- Child:
- 7:4362ea3d5300
--- a/main.cpp Tue Oct 08 04:35:23 2019 +0000
+++ b/main.cpp Mon Dec 02 14:22:07 2019 +0000
@@ -15,10 +15,14 @@
int main()
{
pc.baud(115200);
+ dianciji.baud(115200);
+ shouzhua.baud(115200);
command.baud(115200);
command.attach(&serial_command_isr);
- sf_m_c = 0; // 主要为接收模式
+ //sf_m_c = 0; // 主要为接收模式
+
+
board.baud(115200);
board.attach(&serial_board_isr);
@@ -44,13 +48,20 @@
{
counter++;
+ //获取AD
+ ad1 = AD1.read() * 3300;
+ ad2 = AD2.read() * 3300;
+
//////////////////////// CAN获取电机位置速度信息 //////////////////////////
pf_can.read(pf_rxMsg);
unpack_reply(pf_rxMsg, &a_state);
wait_us(10);
df_can.read(df_rxMsg);
unpack_reply(df_rxMsg, &a_state);
- /**********************************************************************/
+
+ ppf = a_state.pf.p; // 从CAN获得的当前位置
+ pdf = a_state.df.p;
+ //====================================================================//
/////////////////////// 485获取步态,力传感器信息 //////////////////////////
sf_m_b = 1; // 发送模式
@@ -74,7 +85,7 @@
ad_decode();
//pc.printf("A2B: %f - %f\n\r", ad_pf, ad_df);
ad_clear();
- /**********************************************************************/
+ //====================================================================//
////////////////////////// 电机状态控制,命令发送 //////////////////////////
control();
@@ -83,6 +94,7 @@
{
PackAll();
WriteAll();
+ //send_enable = 0;
}
/**********************************************************************/
@@ -98,8 +110,13 @@
*/
//pc.printf("\n\rPpd: %f - %f\r", SP_pf, SP_df);
- //pc.printf("\n\rPpd: %f - %f\r", a_state.pf.p, a_state.df.p);
- pc.printf("A1B: %d - %d - %f - %f - %f\r", Gait_num_valid_real, Gait_now_real, Gait_per_now_real, COP_Y_real, COP_X_real);
+ pc.printf("\n\rC: %f - %f\r", a_control.pf.p_des, a_control.df.p_des);
+ pc.printf("\n\rP: %f - %f\r", a_state.pf.p, a_state.df.p);
+
+ //dianciji.printf(); //电刺激输出
+ //shouzhua.printf(); //手抓输出
+
+ //pc.printf("A1B: %d - %d - %f - %f - %f\r", Gait_num_valid_real, Gait_now_real, Gait_per_now_real, COP_Y_real, COP_X_real);
//pc.printf("A2B: %f - %f\n\r", ad_pf_real, ad_df_real);
/**********************************************************************/
}