if(local_point_id+keep_point+chang_lane_point<x_orignal.size()) { local_x.assign(x_orignal.begin()+local_point_id,x_orignal.begin()+local_point_id+keep_point+1); local_y.assign(y_orignal.begin()+local_point_id,y_orignal.begin()+local_point_id+keep_point+1); local_yaw.assign(yaw_orignal.begin()+local_point_id,yaw_orignal.begin()+local_point_id+keep_point); for (unsigned int i = 0; i < int(chang_lane_point/2); i++) { double local_xx=(i+1)*abs(x_average); double local_yy=(local_axis_point[1]/abs(local_axis_point[1]))*(i+1)*abs(x_average) * tan(change_rate_angle*(i+1)); local_x.push_back(local_xx*cos(yaw_orignal[local_point_id+keep_point])-local_yy*sin(yaw_orignal[local_point_id+keep_point])+x_orignal[local_point_id+keep_point]); local_y.push_back(local_xx*sin(yaw_orignal[local_point_id+keep_point])+local_yy*cos(yaw_orignal[local_point_id+keep_point])+y_orignal[local_point_id+keep_point]); local_yaw.push_back(change_rate_angle*(i+1)); } local_x.push_back(local_axis_point[0]/2*cos(yaw_orignal[local_point_id+keep_point])-local_axis_point[1]/2*sin(yaw_orignal[local_point_id+keep_point])+x_orignal[local_point_id+keep_point] ); local_y.push_back(local_axis_point[0]/2*sin(yaw_orignal[local_point_id+keep_point])+local_axis_point[1]/2*cos(yaw_orignal[local_point_id+keep_point])+y_orignal[local_point_id+keep_point] ); local_yaw.push_back(change_rate_angle*12); for (unsigned int i = 0; i < int(chang_lane_point/2); i++) { double local_xx_2=local_axis_point[0]-(int(chang_lane_point/2)-i)*abs(x_average); double local_yy_2=local_axis_point[1]-(local_axis_point[1]/abs(local_axis_point[1]))*(int(chang_lane_point/2)-i)*abs(x_average) * tan((change_rate_angle*(int(chang_lane_point/2)-i))); local_x.push_back(local_xx_2*cos(yaw_orignal[local_point_id+keep_point] )-local_yy_2*sin(yaw_orignal[local_point_id+keep_point] )+x_orignal[local_point_id+keep_point]); local_y.push_back(local_xx_2*sin(yaw_orignal[local_point_id+keep_point] )+local_yy_2*cos(yaw_orignal[local_point_id+keep_point] )+y_orignal[local_point_id+keep_point]); local_yaw.push_back(change_rate_angle*(int(chang_lane_point/2)-i)); } if(keep_point+chang_lane_point<local_path_size) { local_x.insert(local_x.end(),x_target.begin()+local_point_id+keep_point+chang_lane_point,x_target.begin()+(local_path_size+local_point_id-1)); local_y.insert(local_y.end(),y_target.begin()+local_point_id+keep_point+chang_lane_point,y_target.begin()+(local_path_size+local_point_id-1)); local_yaw.insert(local_yaw.end(),yaw_orignal.begin()+local_point_id+keep_point+chang_lane_point,yaw_orignal.begin()+(local_path_size+local_point_id-1)); } else { cout<<"keep_point + chang_lane_point 大于"<<local_path_size<<endl; }
时间: 2023-09-14 16:07:27 浏览: 102
简单的增差等操作
这段代码是在给定一些条件的情况下,将一些值添加到 `local_x`、`local_y` 和 `local_yaw` 向量中的过程。首先,它检查 `local_point_id+keep_point+chang_lane_point` 是否小于 `x_orignal` 向量的大小。如果是,则将一些值从 `x_orignal`、`y_orignal` 和 `yaw_orignal` 向量中复制到 `local_x`、`local_y` 和 `local_yaw` 向量中。接下来,它使用一些循环和计算来计算一些局部路径点的坐标和角度,并将它们添加到 `local_x`、`local_y` 和 `local_yaw` 向量中。最后,如果满足条件 `keep_point+chang_lane_point<local_path_size`,则将一些额外的值从 `x_target`、`y_target` 和 `yaw_orignal` 向量中添加到 `local_x`、`local_y` 和 `local_yaw` 向量中。否则,输出一条错误消息。
需要注意的是,代码中的一些计算和索引操作可能需要进一步检查和验证,以确保其正确性和边界情况的处理。同时,代码中的输出语句 `cout<<"keep_point + chang_lane_point 大于"<<local_path_size<<endl;` 可能需要根据实际需求进行修改或处理。
阅读全文