• 大小: 59.19MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-05-30
  • 语言: 其他
  • 标签: ROS  源代码  西班牙  

资源简介

这是《ROS机器人程序设计》(英文名Learing ORfor Robotics Programming)的用到的例程的所有源代码。本人辛苦从作者网站上祈求过来的。造福懒人,不用自己敲代码!

资源截图

代码片段和文件信息


#include 

#include 

#include 
#include 

#include 

#include 

namespace rosbook_arm_hardware_gazebo
{
  using namespace hardware_interface;

  ROSBookArmHardwareGazebo::ROSBookArmHardwareGazebo()
    : gazebo_ros_control::RobotHWSim()
  {}


  bool ROSBookArmHardwareGazebo::initSim(const std::string& robot_namespace
      ros::NodeHandle nh
      gazebo::physics::ModelPtr model
      const urdf::Model* const urdf_model
      std::vector transmissions)
  {
    using gazebo::physics::JointPtr;

    // Cleanup
    sim_joints_.clear();
    jnt_pos_.clear();
    jnt_vel_.clear();
    jnt_eff_.clear();
    jnt_pos_cmd_.clear();

    // Simulation joints
    sim_joints_ = model->GetJoints();
    n_dof_ = sim_joints_.size();

    std::vector jnt_names;
    for (size_t i = 0; i < n_dof_; ++i)
    {
      jnt_names.push_back(sim_joints_[i]->GetName());
    }

    // Raw data
    jnt_pos_.resize(n_dof_);
    jnt_vel_.resize(n_dof_);
    jnt_eff_.resize(n_dof_);
    jnt_pos_cmd_.resize(n_dof_);

    // Hardware interfaces
    for (size_t i = 0; i < n_dof_; ++i)
    {
      jnt_state_interface_.registerHandle(
          JointStateHandle(jnt_names[i] &jnt_pos_[i] &jnt_vel_[i] &jnt_eff_[i]));

      jnt_pos_cmd_interface_.registerHandle(
          JointHandle(jnt_state_interface_.getHandle(jnt_names[i]) &jnt_pos_cmd_[i]));

      ROS_DEBUG_STREAM(“Registered joint ‘“ << jnt_names[i] << “‘ in the PositionJointInterface.“);
    }

    registerInterface(&jnt_state_interface_);
    registerInterface(&jnt_pos_cmd_interface_);

    // Position joint limits interface
    std::vector cmd_handle_names = jnt_pos_cmd_interface_.getNames();
    for (size_t i = 0; i < n_dof_; ++i)
    {
      const std::string name = cmd_handle_names[i];
      JointHandle cmd_handle = jnt_pos_cmd_interface_.getHandle(name);

      using namespace joint_limits_interface;
      boost::shared_ptr urdf_joint = urdf_model->getJoint(name);
      JointLimits limits;
      SoftJointLimits soft_limits;
      if (!getJointLimits(urdf_joint limits) || !getSoftJointLimits(urdf_joint soft_limits))
      {
        ROS_WARN_STREAM(“Joint limits won‘t be enforced for joint ‘“ << name << “‘.“);
      }
      else
      {
        jnt_limits_interface_.registerHandle(
            PositionJointSoftLimitsHandle(cmd_handle limits soft_limits));

        ROS_DEBUG_STREAM(“Joint limits will be enforced for joint ‘“ << name << “‘.“);
      }
    }

    // PID controllers
    pids_.resize(n_dof_);
    for (size_t i = 0; i < n_dof_; ++i)
    {
      ros::NodeHandle joint_nh(nh “gains/“ + jnt_names[i]);

      if (!pids_[i].init(joint_nh))
      {
        return false;
      }
    }

    return

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\
     文件        2498  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\README.md
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\
     文件        1523  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\LICENSE
     文件        1798  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\README.md
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\chapter10_tutorials\
     文件         118  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\chapter10_tutorials\CMakeLists.txt
     文件         564  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\chapter10_tutorials\package.xml
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\images\
     文件      146480  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\images\rosbook_arm_moveit.png
     文件      116044  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\images\rosbook_arm_moveit_no_controllers.png
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\
     文件         251  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\CMakeLists.txt
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\config\
     文件         213  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\config\approach_planner.yaml
     文件         832  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\config\rosbook_arm_motions.yaml
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\launch\
     文件         366  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\launch\play_motion.launch
     文件         615  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\launch\rosbook_arm_bringup.launch
     文件         657  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_bringup\package.xml
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration\
     文件         261  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration\CMakeLists.txt
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration\launch\
     文件         366  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration\launch\default_controllers.launch
     文件         585  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration\package.xml
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration_gazebo\
     文件         268  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration_gazebo\CMakeLists.txt
     目录           0  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration_gazebo\config\
     文件         933  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration_gazebo\config\joint_trajectory_controllers.yaml
     文件         569  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration_gazebo\config\pids.yaml
     文件         462  2017-02-22 15:09  Learning_ROS_for_Robotics_Programming_2nd_edition-hydro-devel\chapter10_tutorials\rosbook_arm_controller_configuration_gazebo\package.xml
............此处省略384个文件信息

评论

共有 条评论