|
@@ -263,10 +263,10 @@ Error_manager Dispatch_process::connect_dispatch_device()
|
|
|
mp_catcher = Dispatch_manager::get_instance_references().m_catcher_map[1];
|
|
|
}
|
|
|
|
|
|
+ Catcher* tp_catcher = (Catcher*)mp_catcher.get();
|
|
|
//检查设备状态
|
|
|
- if ( mp_catcher->check_status() == Error_code::SUCCESS &&
|
|
|
- mp_catcher->m_actual_device_status == Dispatch_device_base::DEVICE_READY &&
|
|
|
- mp_catcher->m_actual_load_status == Dispatch_device_base::NO_CAR)
|
|
|
+ if ( tp_catcher->check_status() == Error_code::SUCCESS &&
|
|
|
+ tp_catcher->m_actual_device_status == Dispatch_device_base::DEVICE_READY )
|
|
|
{
|
|
|
//创建任务单
|
|
|
mp_catcher_task = std::shared_ptr<Task_Base>(new Catcher_task);
|
|
@@ -275,16 +275,16 @@ Error_manager Dispatch_process::connect_dispatch_device()
|
|
|
|
|
|
//第一次发送 空的唯一码, 可以和设备建立联系
|
|
|
tp_catcher_task->m_request_key = "";
|
|
|
- tp_catcher_task->m_request_x = mp_catcher->m_actual_x;
|
|
|
- tp_catcher_task->m_request_y = mp_catcher->m_actual_y;
|
|
|
- tp_catcher_task->m_request_b = mp_catcher->m_actual_b;
|
|
|
- tp_catcher_task->m_request_z = mp_catcher->m_actual_z;
|
|
|
- tp_catcher_task->m_request_d1 = mp_catcher->m_actual_d1;
|
|
|
- tp_catcher_task->m_request_d2 = mp_catcher->m_actual_d2;
|
|
|
+ tp_catcher_task->m_request_x = tp_catcher->m_actual_x;
|
|
|
+ tp_catcher_task->m_request_y = tp_catcher->m_actual_y;
|
|
|
+ tp_catcher_task->m_request_b = tp_catcher->m_actual_b;
|
|
|
+ tp_catcher_task->m_request_z = tp_catcher->m_actual_z;
|
|
|
+ tp_catcher_task->m_request_d1 = tp_catcher->m_actual_d1;
|
|
|
+ tp_catcher_task->m_request_d2 = tp_catcher->m_actual_d2;
|
|
|
tp_catcher_task->m_request_wheelbase = Dispatch_coordinates::get_instance_references().m_default_wheelbase;
|
|
|
- tp_catcher_task->m_request_clamp_motion = (Catcher_task::Clamp_motion)mp_catcher->m_actual_clamp_motion1;
|
|
|
+ tp_catcher_task->m_request_clamp_motion = (Catcher_task::Clamp_motion)tp_catcher->m_actual_clamp_motion1;
|
|
|
|
|
|
- t_error = mp_catcher->execute_task(mp_catcher_task, Dispatch_device_base::E_ONE_LEVEL);
|
|
|
+ t_error = tp_catcher->execute_task(mp_catcher_task, Dispatch_device_base::E_ONE_LEVEL);
|
|
|
if ( t_error != Error_code::SUCCESS )
|
|
|
{
|
|
|
return t_error;
|
|
@@ -297,36 +297,9 @@ Error_manager Dispatch_process::connect_dispatch_device()
|
|
|
}
|
|
|
|
|
|
//设置起点
|
|
|
- if ( m_dispatch_control_request_msg.dispatch_source() == 0 )
|
|
|
- {
|
|
|
- m_source_coordinates.x = 0;
|
|
|
- m_source_coordinates.y = 0;
|
|
|
- m_source_coordinates.z = 0;
|
|
|
- }
|
|
|
- else if ( m_dispatch_control_request_msg.dispatch_source() > 0 && m_dispatch_control_request_msg.dispatch_source() <= 165)
|
|
|
- {
|
|
|
- m_source_coordinates = Dispatch_coordinates::get_instance_references().m_packspace_coordinates[m_dispatch_control_request_msg.dispatch_source()];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_source_coordinates = Dispatch_coordinates::get_instance_references().m_catcher_coordinates[m_dispatch_control_request_msg.dispatch_source()];
|
|
|
- }
|
|
|
-
|
|
|
+ m_source_coordinates = Dispatch_coordinates::get_instance_references().m_catcher_coordinates[m_dispatch_control_request_msg.dispatch_source()];
|
|
|
//设置终点
|
|
|
- if ( m_dispatch_control_request_msg.dispatch_destination() == 0 )
|
|
|
- {
|
|
|
- m_destination_coordinates.x = 0;
|
|
|
- m_destination_coordinates.y = 0;
|
|
|
- m_destination_coordinates.z = 0;
|
|
|
- }
|
|
|
- else if ( m_dispatch_control_request_msg.dispatch_destination() > 0 && m_dispatch_control_request_msg.dispatch_destination() <= 165)
|
|
|
- {
|
|
|
- m_destination_coordinates = Dispatch_coordinates::get_instance_references().m_packspace_coordinates[m_dispatch_control_request_msg.dispatch_destination()];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_destination_coordinates = Dispatch_coordinates::get_instance_references().m_catcher_coordinates[m_dispatch_control_request_msg.dispatch_destination()];
|
|
|
- }
|
|
|
+ m_destination_coordinates = Dispatch_coordinates::get_instance_references().m_catcher_coordinates[m_dispatch_control_request_msg.dispatch_destination()];
|
|
|
}
|
|
|
//搬运器的配置 准备工作
|
|
|
else if ( m_dispatch_control_request_msg.dispatch_device_type() >= message::Dispatch_device_type::CARRIER_1 &&
|
|
@@ -346,10 +319,10 @@ Error_manager Dispatch_process::connect_dispatch_device()
|
|
|
mp_carrier = Dispatch_manager::get_instance_references().m_carrier_map[1];
|
|
|
}
|
|
|
|
|
|
+ Carrier* tp_carrier = (Carrier*)mp_carrier.get();
|
|
|
//检查设备状态
|
|
|
- if ( mp_carrier->check_status() == Error_code::SUCCESS &&
|
|
|
- mp_carrier->m_actual_device_status == Dispatch_device_base::DEVICE_READY &&
|
|
|
- mp_carrier->m_actual_load_status == Dispatch_device_base::NO_CAR)
|
|
|
+ if ( tp_carrier->check_status() == Error_code::SUCCESS &&
|
|
|
+ tp_carrier->m_actual_device_status == Dispatch_device_base::DEVICE_READY )
|
|
|
{
|
|
|
//创建任务单
|
|
|
mp_carrier_task = std::shared_ptr<Task_Base>(new Carrier_task);
|
|
@@ -358,19 +331,19 @@ Error_manager Dispatch_process::connect_dispatch_device()
|
|
|
|
|
|
//第一次发送 空的唯一码, 可以和设备建立联系
|
|
|
tp_carrier_task->m_request_key = "";
|
|
|
- tp_carrier_task->m_request_x = mp_carrier->m_actual_x;
|
|
|
- tp_carrier_task->m_request_y = mp_carrier->m_actual_y;
|
|
|
- tp_carrier_task->m_request_z = mp_carrier->m_actual_z;
|
|
|
- tp_carrier_task->m_request_y1 = mp_carrier->m_actual_y1;
|
|
|
- tp_carrier_task->m_request_y2 = mp_carrier->m_actual_y2;
|
|
|
- tp_carrier_task->m_request_clamp_motion = (Carrier_task::Clamp_motion)mp_carrier->m_actual_clamp_motion1;
|
|
|
- tp_carrier_task->m_request_joint_motion_x = (Carrier_task::Joint_motion)mp_carrier->m_actual_joint_motion_x1;
|
|
|
+ tp_carrier_task->m_request_x = tp_carrier->m_actual_x;
|
|
|
+ tp_carrier_task->m_request_y = tp_carrier->m_actual_y;
|
|
|
+ tp_carrier_task->m_request_z = tp_carrier->m_actual_z;
|
|
|
+ tp_carrier_task->m_request_y1 = tp_carrier->m_actual_y1;
|
|
|
+ tp_carrier_task->m_request_y2 = tp_carrier->m_actual_y2;
|
|
|
+ tp_carrier_task->m_request_clamp_motion = (Carrier_task::Clamp_motion)tp_carrier->m_actual_clamp_motion1;
|
|
|
+ tp_carrier_task->m_request_joint_motion_x = (Carrier_task::Joint_motion)tp_carrier->m_actual_joint_motion_x1;
|
|
|
tp_carrier_task->m_request_joint_motion_y = Carrier_task::Joint_motion::E_JOINT_NO_ACTION;
|
|
|
tp_carrier_task->m_request_space_id = 0;
|
|
|
tp_carrier_task->m_request_floor_id = 0;
|
|
|
tp_carrier_task->m_request_wheelbase = Dispatch_coordinates::get_instance_references().m_default_wheelbase;
|
|
|
|
|
|
- t_error = mp_carrier->execute_task(mp_catcher_task, Dispatch_device_base::E_ONE_LEVEL);
|
|
|
+ t_error = tp_carrier->execute_task(mp_catcher_task, Dispatch_device_base::E_ONE_LEVEL);
|
|
|
if ( t_error != Error_code::SUCCESS )
|
|
|
{
|
|
|
return t_error;
|
|
@@ -383,36 +356,10 @@ Error_manager Dispatch_process::connect_dispatch_device()
|
|
|
}
|
|
|
|
|
|
//设置起点
|
|
|
- if ( m_dispatch_control_request_msg.dispatch_source() == 0 )
|
|
|
- {
|
|
|
- m_source_coordinates.x = 0;
|
|
|
- m_source_coordinates.y = 0;
|
|
|
- m_source_coordinates.z = 0;
|
|
|
- }
|
|
|
- else if ( m_dispatch_control_request_msg.dispatch_source() > 0 && m_dispatch_control_request_msg.dispatch_source() <= 165)
|
|
|
- {
|
|
|
- m_source_coordinates = Dispatch_coordinates::get_instance_references().m_packspace_coordinates[m_dispatch_control_request_msg.dispatch_source()];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_source_coordinates = Dispatch_coordinates::get_instance_references().m_carrier_coordinates[m_dispatch_control_request_msg.dispatch_source()];
|
|
|
- }
|
|
|
-
|
|
|
+ m_source_coordinates = Dispatch_coordinates::get_instance_references().m_carrier_coordinates[m_dispatch_control_request_msg.dispatch_source()];
|
|
|
//设置终点
|
|
|
- if ( m_dispatch_control_request_msg.dispatch_destination() == 0 )
|
|
|
- {
|
|
|
- m_destination_coordinates.x = 0;
|
|
|
- m_destination_coordinates.y = 0;
|
|
|
- m_destination_coordinates.z = 0;
|
|
|
- }
|
|
|
- else if ( m_dispatch_control_request_msg.dispatch_destination() > 0 && m_dispatch_control_request_msg.dispatch_destination() <= 165)
|
|
|
- {
|
|
|
- m_destination_coordinates = Dispatch_coordinates::get_instance_references().m_packspace_coordinates[m_dispatch_control_request_msg.dispatch_destination()];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_destination_coordinates = Dispatch_coordinates::get_instance_references().m_carrier_coordinates[m_dispatch_control_request_msg.dispatch_destination()];
|
|
|
- }
|
|
|
+ m_destination_coordinates = Dispatch_coordinates::get_instance_references().m_carrier_coordinates[m_dispatch_control_request_msg.dispatch_destination()];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return Error_code::SUCCESS;
|
|
@@ -503,22 +450,50 @@ Error_manager Dispatch_process::check_passageway_task()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//检查 任务单 是否完成任务, 里面会调整短步骤
|
|
|
+Error_manager Dispatch_process::check_task_ex(std::shared_ptr<Task_Base> p_catcher_task, int& step)
|
|
|
+{
|
|
|
+ if ( p_catcher_task.get() == NULL )
|
|
|
+ {
|
|
|
+ return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
|
|
|
+ "Dispatch_process::check_passageway_task POINTER IS NULL ");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if ( p_catcher_task->get_task_statu() == Task_Base::Task_statu::TASK_OVER )
|
|
|
+ {
|
|
|
+ step++;
|
|
|
+ return Error_code::NODATA; //这里返回nodata 表示任务继续下一步
|
|
|
+ }
|
|
|
+ else if ( p_catcher_task->get_task_statu() == Task_Base::Task_statu::TASK_ERROR )
|
|
|
+ {
|
|
|
+ step = 0;
|
|
|
+ return p_catcher_task->get_task_error_manager();
|
|
|
+ }
|
|
|
+ else if ( p_catcher_task->get_task_statu() == Task_Base::Task_statu::TASK_WORKING &&
|
|
|
+ p_catcher_task->get_task_statu() == Task_Base::Task_statu::TASK_SIGNED &&
|
|
|
+ p_catcher_task->get_task_statu() == Task_Base::Task_statu::TASK_CREATED)
|
|
|
+ {
|
|
|
+ //继续等待任务, 直到状态改变
|
|
|
+ return Error_code::NODATA;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//执行调度控制指令, 并根据完成情况给答复
|
|
|
Error_manager Dispatch_process::excute_dispatch_control()
|
|
|
{
|
|
|
-
|
|
|
+//设备的动作也使用外部的Main()的线程来循环
|
|
|
return Error_code::SUCCESS;
|
|
|
}
|
|
|
|
|
|
//机器手去入口抓车(例如:机器手移动到2号入口上方,然后下降到一楼抓车,最后上升到最上方)
|
|
|
Error_manager Dispatch_process::excute_robot_catch_car_from_inlet()
|
|
|
{
|
|
|
- std::unique_lock<std::mutex> t_lock(m_lock);
|
|
|
Error_manager t_error;
|
|
|
-
|
|
|
- //设备的动作也使用外部的Main()的线程来循环
|
|
|
- static int s_step = 0;
|
|
|
+ Catcher * tp_catcher = NULL;
|
|
|
Catcher_task * tp_catcher_task = NULL;
|
|
|
+ Dispatch_coordinates * tp_dispatch_coordinates = Dispatch_coordinates::get_instance_pointer();
|
|
|
|
|
|
if ( mp_catcher.get() == NULL || mp_catcher_task.get() == NULL )
|
|
|
{
|
|
@@ -527,41 +502,436 @@ Error_manager Dispatch_process::excute_robot_catch_car_from_inlet()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ tp_catcher = (Catcher *)mp_catcher.get();
|
|
|
tp_catcher_task = (Catcher_task *)mp_catcher_task.get();
|
|
|
}
|
|
|
|
|
|
- if ( s_step == 0 )
|
|
|
+ if ( tp_catcher_task->m_step == 0 )
|
|
|
{
|
|
|
- t_error = check_catcher_task();
|
|
|
- if ( t_error == Error_code::SUCCESS )
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 1 )//检查姿态
|
|
|
+ {
|
|
|
+ //检查姿态
|
|
|
+ if ( tp_catcher->m_actual_load_status == Dispatch_device_base::Load_status::NO_CAR )
|
|
|
{
|
|
|
- s_step++;//成功完成之后, 并不返回, 直接进入下一步
|
|
|
+ if ( tp_catcher->m_actual_clamp_motion1 != Dispatch_device_base::Clamp_motion::E_CLAMP_LOOSE ||
|
|
|
+ tp_catcher->m_actual_d1 + tp_catcher->m_actual_d2 + tp_dispatch_coordinates->m_catcher_d1_d2_distance >
|
|
|
+ tp_dispatch_coordinates->m_catcher_wheel_base_limit ||
|
|
|
+ tp_catcher->m_catcher_direction == Dispatch_device_base::Catcher_direction::CATCHER_DIRECTION_UNKNOW )
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //调整姿态
|
|
|
+ tp_catcher_task->m_request_clamp_motion = Catcher_task::Clamp_motion::E_CLAMP_LOOSE;
|
|
|
+ tp_catcher_task->m_request_d1 = tp_dispatch_coordinates->m_catcher_d1_min;
|
|
|
+ tp_catcher_task->m_request_d2 = tp_dispatch_coordinates->m_catcher_d2_min;
|
|
|
+ tp_catcher_task->m_request_b = 90;
|
|
|
+
|
|
|
+ tp_catcher_task->m_step++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_step +=2;
|
|
|
+ }
|
|
|
}
|
|
|
- else if( t_error == Error_code::NODATA )
|
|
|
+ else
|
|
|
{
|
|
|
- //什么也不做, 继续等待任务完成, 此时Main函数会一直循环.
|
|
|
+ return Error_manager(Error_code::CATCHER_POSE_ERROR, Error_level::MINOR_ERROR,
|
|
|
+ "tp_catcher->m_actual_load_status != Dispatch_device_base::Load_status::NO_CAR fun error ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 2 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 3 )//机器手z轴移到最高点.
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //机器手z轴移到最高点.
|
|
|
+ tp_catcher_task->m_request_z = tp_dispatch_coordinates->m_catcher_4th_floor_z;
|
|
|
+
|
|
|
+ tp_catcher_task->m_step++;
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 4 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 5 )//机器手 调整x y b d1 d2, 根据感测模块的定位信息, 调整机器手的姿态, 准备抓车.
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //机器手 调整x y b d1 d2, 根据感测模块的定位信息, 调整机器手的姿态, 准备抓车.
|
|
|
+ tp_catcher_task->m_request_x = m_car_measure_information.center_x;
|
|
|
+ tp_catcher_task->m_request_y = m_car_measure_information.center_y;
|
|
|
+ if ( tp_catcher->m_catcher_direction == Dispatch_device_base::Catcher_direction::CATCHER_DIRECTION_NEGATIVE )
|
|
|
+ {
|
|
|
+ //机器手如果旋转反向, 那就+180即可, 没有必要旋转归位.
|
|
|
+ tp_catcher_task->m_request_b = 180 + m_car_measure_information.car_angle;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_b = m_car_measure_information.car_angle;
|
|
|
+ }
|
|
|
+ //限制轮距, 在夹车杆松开时, 机器人下降时, 轴距不能超过3000mm, 必须下降到最下面才能调整轴距, 夹车后可以上升.
|
|
|
+ if ( m_car_measure_information.car_wheel_base > tp_dispatch_coordinates->m_catcher_wheel_base_limit )
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_d1 = (tp_dispatch_coordinates->m_catcher_wheel_base_limit - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_d2 = (tp_dispatch_coordinates->m_catcher_wheel_base_limit - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_wheelbase = tp_dispatch_coordinates->m_catcher_wheel_base_limit;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- s_step = 0;
|
|
|
- return t_error;
|
|
|
+ tp_catcher_task->m_request_d1 = (m_car_measure_information.car_wheel_base - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_d2 = (m_car_measure_information.car_wheel_base - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_wheelbase = m_car_measure_information.car_wheel_base;
|
|
|
}
|
|
|
+ tp_catcher_task->m_request_clamp_motion = Catcher_task::Clamp_motion::E_CLAMP_LOOSE;
|
|
|
+
|
|
|
+ tp_catcher_task->m_step++;
|
|
|
}
|
|
|
- if ( s_step == 1 )
|
|
|
+ if ( tp_catcher_task->m_step == 6 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 7 )//机器手z轴移到最低点.
|
|
|
{
|
|
|
std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
char t_key[50] = {0};
|
|
|
- sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), s_step);
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
tp_catcher_task->m_respons_key = t_key;
|
|
|
- //机器手z轴移到最高点.
|
|
|
- tp_catcher_task->m_request_z = Dispatch_coordinates::get_instance_references().m_catcher_4th_floor_z;
|
|
|
+
|
|
|
+ //机器手z轴移到最低点.
|
|
|
+ tp_catcher_task->m_request_z = tp_dispatch_coordinates->m_catcher_1th_floor_z;
|
|
|
+
|
|
|
+ tp_catcher_task->m_step++;
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 8 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 9 )//修正轴距, 如果轴距大于3000mm, 那么就要修正轴距.
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ //修正轴距, 如果轴距大于3000mm, 那么就要修正轴距.
|
|
|
+ if ( m_car_measure_information.car_wheel_base > tp_dispatch_coordinates->m_catcher_wheel_base_limit )
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+ //修正轴距
|
|
|
+ tp_catcher_task->m_request_d1 = (m_car_measure_information.car_wheel_base - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_d2 = (m_car_measure_information.car_wheel_base - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_wheelbase = m_car_measure_information.car_wheel_base;
|
|
|
+ tp_catcher_task->m_step++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_step = tp_catcher_task->m_step +2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 10 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 11 )//机器手 夹车
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //机器手 夹车
|
|
|
+ tp_catcher_task->m_request_clamp_motion = Catcher_task::Clamp_motion::E_CLAMP_TIGHT;
|
|
|
+
|
|
|
+ tp_catcher_task->m_step++;
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 12 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 13 )//机器手 z轴上升到最高处
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //机器手 z轴上升到最高处
|
|
|
+ tp_catcher_task->m_request_z = tp_dispatch_coordinates->m_catcher_4th_floor_z;
|
|
|
+
|
|
|
+ tp_catcher_task->m_step++;
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 14 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 15 )
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //机器手 调整x y b d1 d2, 调整机器手的姿态, 准备把车放置到中跑车上.
|
|
|
+ tp_catcher_task->m_request_x = m_destination_coordinates.x;
|
|
|
+ tp_catcher_task->m_request_y = tp_dispatch_coordinates->m_carrier_default_y1_back - (tp_catcher_task->m_request_wheelbase /2);
|
|
|
+ //存车需要反向, 取车不需要
|
|
|
+ if ( tp_catcher->m_catcher_direction == Dispatch_device_base::Catcher_direction::CATCHER_DIRECTION_NEGATIVE )
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_b = 90;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_b = 270;
|
|
|
+ }
|
|
|
+ tp_catcher_task->m_step++;
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 16 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_catcher_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_catcher_task->m_step == 17 )
|
|
|
+ {
|
|
|
+ return Error_code::SUCCESS;
|
|
|
}
|
|
|
}
|
|
|
//机器手把车放到中跑车上面(例如:机器手下降到中跑车上放车,最后上升到最上方)(通过目标点 指定放到哪一个中跑车上)
|
|
|
Error_manager Dispatch_process::excute_robot_put_car_to_carrier()
|
|
|
{
|
|
|
|
|
|
+}
|
|
|
+//机器手去中跑车上抓车(例如:机器手移动到1号中跑车上方,然后下降到中跑车抓车,最后上升到最上方)
|
|
|
+Error_manager Dispatch_process::excute_robot_catch_car_from_carrier()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+//机器手去出口放车(例如:机器手移动到3号出口上方,然后下降到一楼放车,最后上升到最上方)
|
|
|
+Error_manager Dispatch_process::excute_robot_put_car_to_outlet()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+//机器手的自由移动(例如:机器手移动到6号出入口的上方4楼处,给其他设备避让)(不进行抓车和放车的操作)
|
|
|
+Error_manager Dispatch_process::excute_robot_move()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+//搬运器从机器手上接车(例如:搬运器移动到2号入口的上方,然后等待机器手把车放到中跑车上,小跑车保持松夹杆状态)
|
|
|
+Error_manager Dispatch_process::excute_carrier_receive_car_from_robot()
|
|
|
+{
|
|
|
+ Error_manager t_error;
|
|
|
+ Carrier * tp_carrier = NULL;
|
|
|
+ Carrier_task * tp_carrier_task = NULL;
|
|
|
+ Dispatch_coordinates * tp_dispatch_coordinates = Dispatch_coordinates::get_instance_pointer();
|
|
|
+
|
|
|
+ if ( mp_carrier.get() == NULL || mp_carrier_task.get() == NULL )
|
|
|
+ {
|
|
|
+ return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
|
|
|
+ "Dispatch_process::excute_robot_catch_car_from_inlet() POINTER IS NULL ");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_carrier = (Carrier *)mp_carrier.get();
|
|
|
+ tp_carrier_task = (Carrier_task *)mp_carrier_task.get();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( tp_carrier_task->m_step == 0 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_carrier_task, tp_carrier_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 1 )//检查姿态
|
|
|
+ {
|
|
|
+ //检查姿态
|
|
|
+ if ( tp_carrier->m_actual_load_status == Dispatch_device_base::Load_status::NO_CAR )
|
|
|
+ {
|
|
|
+ if ( tp_carrier_task->m_request_clamp_motion != Carrier_task::Clamp_motion::E_CLAMP_LOOSE )
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_carrier_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_carrier_task->m_step);
|
|
|
+ tp_carrier_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //调整姿态
|
|
|
+ tp_carrier_task->m_request_clamp_motion = Carrier_task::Clamp_motion::E_CLAMP_LOOSE;
|
|
|
+
|
|
|
+ tp_carrier_task->m_step++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_carrier_task->m_step +=2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Error_manager(Error_code::CARRIER_POSE_ERROR, Error_level::MINOR_ERROR,
|
|
|
+ "tp_carrier->m_actual_load_status != Dispatch_device_base::Load_status::NO_CAR fun error ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 2 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_carrier_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 3 )//让小跑车回到中跑车上
|
|
|
+ {
|
|
|
+ if ( Common_data::approximate(tp_carrier->m_actual_y, tp_dispatch_coordinates->m_carrier_default_y_back, 0.01) )
|
|
|
+ {
|
|
|
+ tp_carrier_task->m_step +=2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_carrier_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_carrier_task->m_step);
|
|
|
+ tp_carrier_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //让小跑车回到中跑车上
|
|
|
+ tp_carrier_task->m_request_y = tp_dispatch_coordinates->m_carrier_default_y_back;
|
|
|
+ tp_carrier_task->m_request_wheelbase = m_car_measure_information.car_wheel_base;
|
|
|
+ tp_carrier_task->m_request_y1 = tp_dispatch_coordinates->m_carrier_default_y1_back;
|
|
|
+ tp_carrier_task->m_request_y2 = tp_carrier_task->m_request_y1 - tp_carrier_task->m_request_wheelbase;
|
|
|
+ tp_carrier_task->m_step++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 4 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_carrier_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 5 )//让中跑车回到电梯井
|
|
|
+ {
|
|
|
+ if ( Common_data::approximate(tp_carrier->m_actual_z, m_destination_coordinates.z, 0.01) )
|
|
|
+ {
|
|
|
+ tp_carrier_task->m_step +=2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_carrier_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_carrier_task->m_step);
|
|
|
+ tp_carrier_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ if ( mp_carrier->get_device_id() == 0 )
|
|
|
+ {
|
|
|
+ //让中跑车回到电梯井
|
|
|
+ tp_carrier_task->m_request_x = tp_dispatch_coordinates->m_carrier_default_x_left;
|
|
|
+ tp_carrier_task->m_step++;
|
|
|
+ }
|
|
|
+ else if ( mp_carrier->get_device_id() == 1 )
|
|
|
+ {
|
|
|
+ //让中跑车回到电梯井
|
|
|
+ tp_carrier_task->m_request_x = tp_dispatch_coordinates->m_carrier_default_x_right;
|
|
|
+ tp_carrier_task->m_step++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Error_manager(Error_code::CARRIER_CONRTOL_PARAMETER_ERROR, Error_level::MINOR_ERROR,
|
|
|
+ " m_destination_coordinates.z PARAMRTER ERROR ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 6 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_carrier_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 7 )//收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
|
|
|
+ {
|
|
|
+ if ( Common_data::approximate(tp_carrier->m_actual_z, m_destination_coordinates.z, 0.01) )
|
|
|
+ {
|
|
|
+ tp_carrier_task->m_step +=2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_carrier_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_carrier_task->m_step);
|
|
|
+ tp_carrier_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
|
|
|
+ tp_carrier_task->m_request_joint_motion_x = Carrier_task::Joint_motion::E_JOINT_TAKE_BACK;
|
|
|
+ tp_carrier_task->m_step++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 8 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_carrier_task->m_step);
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 9 )//收回对接,之后中跑车固定在电梯上不能X轴移动,电梯可以Z轴移动
|
|
|
+ {
|
|
|
+ if ( Common_data::approximate(tp_carrier->m_actual_z, m_destination_coordinates.z, 0.01) )
|
|
|
+ {
|
|
|
+ tp_carrier_task->m_step +=2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_carrier_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_carrier_task->m_step);
|
|
|
+ tp_carrier_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //电梯移动到对应的楼层
|
|
|
+ tp_carrier_task->m_request_z = m_destination_coordinates.z;
|
|
|
+ tp_carrier_task->m_step++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( tp_carrier_task->m_step == 10 )
|
|
|
+ {
|
|
|
+ return check_task_ex(mp_catcher_task, tp_carrier_task->m_step);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+//搬运器把车存到停车位上(例如:小跑车夹车后,搬运器移动到56号停车位,然后小跑车将车存入车位,之后搬运器退回至电梯井)
|
|
|
+Error_manager Dispatch_process::excute_carrier_store_car_to_parkingspace()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+//搬运器把车存到停车位上(例如:小跑车夹车后,搬运器移动到56号停车位,然后小跑车将车存入车位,之后搬运器退回至56车位外面即可)
|
|
|
+Error_manager Dispatch_process::excute_carrier_store_car_to_parkingspace_ex()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+//搬运器从停车位上取车(例如:搬运器移动到56号停车位,然后小跑车将车从车位取出,之后搬运器退回至电梯井)
|
|
|
+Error_manager Dispatch_process::excute_carrier_pickup_car_from_parkingspace()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+//搬运器从停车位上取车(例如:搬运器移动到56号停车位,然后小跑车将车从车位取出,之后搬运器退回至56车位外面即可)
|
|
|
+Error_manager Dispatch_process::excute_carrier_pickup_car_from_parkingspace_ex()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+//搬运器把车交付给机器手(例如:搬运器移动到3号入口的上方,小跑车松夹杆,然后等待机器手把车从中跑车上取走)
|
|
|
+Error_manager Dispatch_process::excute_carrier_deliver_car_to_robot()
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+//搬运器的自由移动(可以提前到2楼来准备接车,或者为了避让就退回至电梯井)(小跑车不进行取车和存车)
|
|
|
+Error_manager Dispatch_process::excute_carrier_move()
|
|
|
+{
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//执行通道口动作
|
|
@@ -606,4 +976,147 @@ Error_manager Dispatch_process::send_dispatch_response_msg()
|
|
|
Error_manager Dispatch_process::release_resource()
|
|
|
{
|
|
|
return Dispatch_manager::get_instance_references().release_dispatch_process(m_command_key);
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+//异常处理
|
|
|
+Error_manager Dispatch_process::Exception_handling()
|
|
|
+{
|
|
|
+ return Error_code::SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+//机器手调整到正常待机的姿态
|
|
|
+Error_manager Dispatch_process::cartcher_adjust_to_ready(Catcher * tp_catcher, Catcher_task * tp_catcher_task, Dispatch_coordinates * tp_dispatch_coordinates)
|
|
|
+{
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //调整姿态
|
|
|
+ tp_catcher_task->m_request_clamp_motion = Catcher_task::Clamp_motion::E_CLAMP_LOOSE;
|
|
|
+ tp_catcher_task->m_request_d1 = tp_dispatch_coordinates->m_catcher_d1_min;
|
|
|
+ tp_catcher_task->m_request_d2 = tp_dispatch_coordinates->m_catcher_d2_min;
|
|
|
+ tp_catcher_task->m_request_b = 90;
|
|
|
+ return Error_code::SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+//机器手 移动z
|
|
|
+Error_manager Dispatch_process::cartcher_move_z(Catcher * tp_catcher, Catcher_task * tp_catcher_task, Dispatch_coordinates * tp_dispatch_coordinates, float target)
|
|
|
+{
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+ //机器手 移动z
|
|
|
+ tp_catcher_task->m_request_z = target;
|
|
|
+ return Error_code::SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+//机器手调整到 准备从地面抓车前的姿态
|
|
|
+Error_manager Dispatch_process::cartcher_adjust_from_ground(Catcher * tp_catcher, Catcher_task * tp_catcher_task, Dispatch_coordinates * tp_dispatch_coordinates)
|
|
|
+{
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //机器手 调整x y b d1 d2, 根据感测模块的定位信息, 调整机器手的姿态, 准备抓车.
|
|
|
+ tp_catcher_task->m_request_x = m_car_measure_information.center_x;
|
|
|
+ tp_catcher_task->m_request_y = m_car_measure_information.center_y;
|
|
|
+ if ( tp_catcher->m_catcher_direction == Dispatch_device_base::Catcher_direction::CATCHER_DIRECTION_NEGATIVE )
|
|
|
+ {
|
|
|
+ //机器手如果旋转反向, 那就+180即可, 没有必要旋转归位.
|
|
|
+ tp_catcher_task->m_request_b = 180 + m_car_measure_information.car_angle;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_b = m_car_measure_information.car_angle;
|
|
|
+ }
|
|
|
+ //限制轮距, 在夹车杆松开时, 机器人下降时, 轴距不能超过3000mm, 必须下降到最下面才能调整轴距, 夹车后可以上升.
|
|
|
+ if ( m_car_measure_information.car_wheel_base > tp_dispatch_coordinates->m_catcher_wheel_base_limit )
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_d1 = (tp_dispatch_coordinates->m_catcher_wheel_base_limit - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_d2 = (tp_dispatch_coordinates->m_catcher_wheel_base_limit - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_wheelbase = tp_dispatch_coordinates->m_catcher_wheel_base_limit;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_d1 = (m_car_measure_information.car_wheel_base - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_d2 = (m_car_measure_information.car_wheel_base - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_wheelbase = m_car_measure_information.car_wheel_base;
|
|
|
+ }
|
|
|
+ tp_catcher_task->m_request_clamp_motion = Catcher_task::Clamp_motion::E_CLAMP_LOOSE;
|
|
|
+
|
|
|
+ return Error_code::SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+//机器手 修正轴距, 如果轴距大于3000mm, 那么就要修正轴距.
|
|
|
+Error_manager Dispatch_process::cartcher_adjust_wheel_base(Catcher * tp_catcher, Catcher_task * tp_catcher_task, Dispatch_coordinates * tp_dispatch_coordinates)
|
|
|
+{
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+ //修正轴距
|
|
|
+ tp_catcher_task->m_request_d1 = (m_car_measure_information.car_wheel_base - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_d2 = (m_car_measure_information.car_wheel_base - tp_dispatch_coordinates->m_catcher_d1_d2_distance)/2;
|
|
|
+ tp_catcher_task->m_request_wheelbase = m_car_measure_information.car_wheel_base;
|
|
|
+ return Error_code::SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+//机器手 移动c轴 夹杆
|
|
|
+Error_manager Dispatch_process::cartcher_move_c(Catcher * tp_catcher, Catcher_task * tp_catcher_task, Dispatch_coordinates * tp_dispatch_coordinates, Catcher_task::Clamp_motion target)
|
|
|
+{
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //机器手 夹车
|
|
|
+ tp_catcher_task->m_request_clamp_motion = target;
|
|
|
+}
|
|
|
+
|
|
|
+//机器手调整到 准备把车放到搬运器的姿态
|
|
|
+Error_manager Dispatch_process::cartcher_adjust_to_carrier(Catcher * tp_catcher, Catcher_task * tp_catcher_task, Dispatch_coordinates * tp_dispatch_coordinates)
|
|
|
+{
|
|
|
+ std::unique_lock<std::mutex> t_lock1(m_lock);
|
|
|
+ std::unique_lock<std::mutex> t_lock2(tp_catcher_task->m_lock);
|
|
|
+ char t_key[50] = {0};
|
|
|
+ sprintf(t_key, "%s+%d+%d", m_dispatch_control_request_msg.command_key().c_str(), m_dispatch_control_request_msg.dispatch_task_type(), tp_catcher_task->m_step);
|
|
|
+ tp_catcher_task->m_respons_key = t_key;
|
|
|
+
|
|
|
+ //机器手 调整x y b d1 d2, 调整机器手的姿态, 准备把车放置到中跑车上.
|
|
|
+ tp_catcher_task->m_request_x = m_destination_coordinates.x;
|
|
|
+ tp_catcher_task->m_request_y = tp_dispatch_coordinates->m_carrier_default_y1_back - (tp_catcher_task->m_request_wheelbase /2);
|
|
|
+ //存车需要反向, 取车不需要
|
|
|
+ if ( tp_catcher->m_catcher_direction == Dispatch_device_base::Catcher_direction::CATCHER_DIRECTION_NEGATIVE )
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_b = 90;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tp_catcher_task->m_request_b = 270;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|