Can pr2_controller_interface/manager/mechanism be used with other robots?

asked 2017-01-16 01:48:41 -0500

Juan gravatar image

updated 2017-01-16 02:07:39 -0500

Greetings,

I am currently using ROS Indigo and Linux Ubuntu 14.04. I found an impedance controller implementation for the PR2 robot found at: https://github.com/jiangxihj/ImpedCon.. .

This code uses the meta-package that contains the pr2_control_interface, pr2_control_manager, and pr2_mechanism. It can read/write joint data without topics.

My question is whether I can directly use this on a robot other than PR2, like the baxter robot? As I have tried to port the code, I have updated the launch and config files appropriately I believe, but the spawner process associated with the PR2_controller_manager always crashes.

My current code can be seen here: https://github.com/birlrobotics/birl_...

I first load baxter as usual: $ ./baxter.sh sim $ roslaunch baxter_gazebo baxter_world.launch

Then I run a roslaunch file that loads the impedance controller:

<launch>
    <!-- Load the impedance controller configuration from the YAML file to parameter server -->
    <rosparam file="$(find imped_control)/config/baxter_imped_controller.yaml" command="load" />

    <!-- Load the default controller -->
    <node pkg="pr2_controller_manager" type="spawner" args="r_arm_cart_imped_controller" name="r_arm_cart_imped_controller_spawner" output="screen"/>

    <!-- Load the default stopped controllers -->
    <node pkg="pr2_controller_manager" type="unspawner" args="r_arm_controller"  name="r_arm_stopper"/>

</launch>

The launch file loads the baxter_imped_controller.yaml file which, calls my impedance controller like this:

robot:
  r_arm_cart_imped_controller:
    type: imped_control/ImpedControlPlugin
    root_name: base
    tip_name: r_gripper_r_finger_tip

The controller type is defined in the controller_plugins.xml code show below:

<library path="lib/libimped_control">
    <class name="imped_control/ImpedControlPlugin"
           type="imped_control_ns::ImpedControlClass"
           base_class_type="pr2_controller_interface::Controller" />
</library>

This plugin code is refered to in the package.xml file:

<package>
  <name>imped_control</name>
  <version>0.0.0</version>
  <description>Baxter impedance control package</description>

  <maintainer email="jhu@todo.todo">jhu</maintainer>
  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>

  <build_depend>pluginlib</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>pr2_controller_interface</build_depend>
  <build_depend>pr2_mechanism_model</build_depend>
  <build_depend>controller_interface</build_depend>
  <build_depend>control_toolbox</build_depend>
  <build_depend>effort_controllers</build_depend>
  <build_depend>baxter_core_msgs</build_depend>
  <build_depend>yaml-cpp</build_depend>

  <run_depend>controller_interface</run_depend>
  <run_depend>control_toolbox</run_depend>
  <run_depend>pr2_controller_interface</run_depend>
  <run_depend>pr2_mechanism_model</run_depend>
  <run_depend>effort_controllers</run_depend>
  <run_depend>baxter_core_msgs</run_depend>
  <run_depend>yaml-cpp</run_depend>
  <run_depend>pluginlib</run_depend>
  <run_depend>roscpp</run_depend>


  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <controller_interface plugin="${prefix}/config/controller_plugins.xml" />
  </export>
</package>

The CMakeLists.txt seems correct and implements a shared library. The file is below and the library can be seen in devel/lib/libimped_control.so

cmake_minimum_required(VERSION 2.8.3)
project(imped_control)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  controller_interface
  control_toolbox
  baxter_core_msgs
  pluginlib
  pr2_controller_interface
  pr2_mechanism_model
  roscpp
)

## System dependencies are found with CMake's conventions
find_package(Boost REQUIRED COMPONENTS system)
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)

find_path(YAML_CPP_INCLUDE_DIR
          NAMES yaml_cpp.h
          PATHS ${YAML_CPP_INCLUDE_DIRS})

find_library(YAML_CPP_LIBRARY
             NAMES YAML_CPP
             PATHS ${YAML_CPP_LIBRARY_DIRS})

if(${YAML_CPP_VERSION} VERSION_LESS 0.5)
  add_definitions(-DDEPRECATED_YAML_CPP_VERSION)
endif()

## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

catkin_package(
  CATKIN_DEPENDS
  pluginlib
  pr2_controller_interface
  pr2_mechanism_model  
  controller_interface
  control_toolbox
  baxter_core_msgs
  roscpp
  DEPENDS yaml-cpp
  INCLUDE_DIRS include
  LIBRARIES ${PROJECT_NAME}
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS ...
(more)
edit retag flag offensive close merge delete