bool LoCoBotController::initControlItems()

in robots/LoCoBot/locobot_control/src/locobot_controller.cpp [239:294]


bool LoCoBotController::initControlItems(void) {
  bool result = false;
  const char *log = NULL;

  auto it = dynamixel_name_2ids_.begin();

  const ControlItem *goal_position = dxl_wb_->getItemInfo(it->second,
                                                          "Goal_Position");
  if (goal_position == NULL) return false;

  const ControlItem *goal_velocity = dxl_wb_->getItemInfo(it->second,
                                                          "Goal_Velocity");
  if (goal_velocity == NULL)
    goal_velocity = dxl_wb_->getItemInfo(it->second,
                                         "Moving_Speed");
  if (goal_velocity == NULL) return false;

  const ControlItem *present_position = dxl_wb_->getItemInfo(it->second,
                                                             "Present_Position");
  if (present_position == NULL) return false;

  const ControlItem *present_velocity = dxl_wb_->getItemInfo(it->second,
                                                             "Present_Velocity");
  if (present_velocity == NULL)
    present_velocity = dxl_wb_->getItemInfo(it->second,
                                            "Present_Speed");
  if (present_velocity == NULL) return false;

  const ControlItem *present_current = dxl_wb_->getItemInfo(it->second,
                                                            "Present_Current");
  if (present_current == NULL)
    present_current = dxl_wb_->getItemInfo(it->second,
                                           "Present_Load");
  if (present_current == NULL) return false;

  const ControlItem *torque_enable = dxl_wb_->getItemInfo(it->second,
                                                          "Torque_Enable");
  if (torque_enable == NULL) return false;

  const ControlItem *shutdown = dxl_wb_->getItemInfo(it->second,
                                                          "Hardware_Error_Status");
  if (shutdown == NULL) return false;

  control_items_["Goal_Position"] = goal_position;
  control_items_["Goal_Velocity"] = goal_velocity;

  control_items_["Present_Position"] = present_position;
  control_items_["Present_Velocity"] = present_velocity;
  control_items_["Present_Current"] = present_current;

  control_items_["Torque_Enable"] = torque_enable;
  control_items_["Hardware_Error_Status"] = shutdown;


  return true;
}