|
@@ -41,12 +41,12 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
|
|
|
|
|
|
//翘脚视为不在地上
|
|
|
//
|
|
|
- if (left_zupt == 1 && left_att[1] * 0.0001f > 0.6f)
|
|
|
+ if (left_zupt == 1 && left_att[1] * 0.0001f > 0.5f)
|
|
|
{
|
|
|
std::cout << "if (left_zupt == 1 && left_att[1] * 0.0001f > 0.6f) " << left_att[1] * 0.0001f << endl;
|
|
|
left_zupt = 0;
|
|
|
}
|
|
|
- if (right_zupt == 1 && right_att[1] * 0.0001f > 0.6f)
|
|
|
+ if (right_zupt == 1 && right_att[1] * 0.0001f > 0.5f)
|
|
|
{
|
|
|
std::cout << "if (right_zupt == 1 && right_att[1] * 0.0001f > 0.6f) " << right_att[1] * 0.0001f << endl;
|
|
|
right_zupt = 0;
|
|
@@ -65,7 +65,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
|
|
|
calGlobalPos(left_shoes_data_vector, left_step_data_vector, left_global_pos, left_heading, 0, LEFT_FOOT);
|
|
|
|
|
|
//通过加速度、以及vector已经缓存了空中的数据来定位判断命令所需的时间戳,这个时间戳是起延时判断的效果,延时是为了等合适的RSSI
|
|
|
- if (left_step_data_vector.size() > 4 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1)
|
|
|
+ if (left_step_data_vector.size() > 9 && left_step_data_vector.front().zupt == 1 && left_step_data_vector.back().zupt == 1)
|
|
|
{
|
|
|
//if (unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left) && press_valid)
|
|
|
if (unzuptValid(max_acc_unzupt_left, min_acc_unzupt_left))
|
|
@@ -78,7 +78,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (right_step_data_vector.size() > 4 && right_step_data_vector.front().zupt == 1 && right_step_data_vector.back().zupt == 1)
|
|
|
+ if (right_step_data_vector.size() > 9 && right_step_data_vector.front().zupt == 1 && right_step_data_vector.back().zupt == 1)
|
|
|
{
|
|
|
//if (unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right) && press_valid)
|
|
|
if (unzuptValid(max_acc_unzupt_right, min_acc_unzupt_right))
|
|
@@ -103,8 +103,7 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
|
|
|
|
|
|
//判断双脚触地的时候, rssi < 23 必须归位,不然也没办法处理
|
|
|
//看起来rssi的延迟有够烂的
|
|
|
- static int count;
|
|
|
- count++;
|
|
|
+
|
|
|
if (left_init == 1 && time_stamp - left_cmd_wait_time >= 9 && time_stamp - left_cmd_wait_time < 30)
|
|
|
{
|
|
|
if (right_init == 1)
|
|
@@ -113,19 +112,37 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
|
|
|
{
|
|
|
result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
|
|
|
|
|
|
- std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi << ", "<< count << std::endl;
|
|
|
+ std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi << ", " << " 合脚" <<std::endl;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
|
|
|
- std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "<< rssi << ", " << count << std::endl;
|
|
|
+
|
|
|
+ std::cout << " MOTION_BOTH_ON_FLOOR_OPEN "<< rssi << ", " << " 开脚"<<std::endl;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- result[0] = MOTION_LEFT_ON_FLOOR;
|
|
|
- std::cout << " MOTION_LEFT_ON_FLOOR " <<time_stamp << ", " << count << std::endl;
|
|
|
+ if (abs(left_att[1] - right_att[1]) < 500)
|
|
|
+ {
|
|
|
+ if (rssi < rssi_threshold)
|
|
|
+ {
|
|
|
+ result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
|
|
|
+
|
|
|
+ std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi << ", " << " 合脚" << std::endl;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
|
|
|
+ std::cout << " MOTION_BOTH_ON_FLOOR_OPEN " << rssi << ", " << " 开脚" << std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result[0] = MOTION_LEFT_ON_FLOOR;
|
|
|
+ std::cout << " MOTION_LEFT_ON_FLOOR " << time_stamp << ", " << " 左单脚" << std::endl;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -144,12 +161,12 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
|
|
|
{
|
|
|
result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
|
|
|
|
|
|
- std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << " "<< rssi << ", " << count << std::endl;
|
|
|
+ std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << " "<< rssi << ", " << " 合脚" << std::endl;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
|
|
|
- std::cout << " MOTION_BOTH_ON_FLOOR_OPEN " << " " << rssi << ", " << count << std::endl;
|
|
|
+ std::cout << " MOTION_BOTH_ON_FLOOR_OPEN " << " " << rssi << ", " << " 开脚"<<std::endl;
|
|
|
}
|
|
|
|
|
|
left_init = 0;
|
|
@@ -158,8 +175,25 @@ void JumpHouse::Process(int time_stamp, int* right_pos, int* right_att, int* rig
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- result[0] = MOTION_RIGHT_ON_FLOOR;
|
|
|
- std::cout << " MOTION_RIGHT_ON_FLOOR " << time_stamp << ", " << count << std::endl;
|
|
|
+ if (abs(left_att[1] - right_att[1]) < 500)
|
|
|
+ {
|
|
|
+ if (rssi < rssi_threshold)
|
|
|
+ {
|
|
|
+ result[0] = MOTION_BOTH_ON_FLOOR_CLOSE;
|
|
|
+
|
|
|
+ std::cout << " MOTION_BOTH_ON_FLOOR_CLOSE " << rssi << ", " << " 合脚" << std::endl;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result[0] = MOTION_BOTH_ON_FLOOR_OPEN;
|
|
|
+ std::cout << " MOTION_BOTH_ON_FLOOR_OPEN " << rssi << ", " << " 开脚" << std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result[0] = MOTION_RIGHT_ON_FLOOR;
|
|
|
+ std::cout << " MOTION_RIGHT_ON_FLOOR " << time_stamp << ", " << "右单脚" << std::endl;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
right_init = 0;
|