forked from bcoudrin/sot_pr2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bcoudrin#2 from francois-keith/master
Use the pr2 with the sot.
- Loading branch information
Showing
82 changed files
with
5,379 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,5 @@ src/lisp/ | |
src/sot_pr2/ | ||
srv/lisp/ | ||
srv_gen/ | ||
|
||
*~ | ||
*.cfgc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: cpp | ||
compiler: | ||
- gcc | ||
matrix: | ||
notifications: | ||
email: | ||
- [email protected] | ||
branches: | ||
only: | ||
- master | ||
- groovy | ||
script: ./.travis/build | ||
before_install: ./.travis/before_install | ||
after_success: ./.travis/after_success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
set -ev | ||
|
||
git config --global user.name "Travis CI" | ||
git config --global user.email "[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
export UBUNTU_CODENAME=`lsb_release -s -c` | ||
export ROS_VERSION=hydro | ||
|
||
echo "Ubuntu codename: $UBUNTU_CODENAME" | ||
echo "ROS version: $ROS_VERSION" | ||
|
||
if `test x$UBUNTU_CODENAME = x`; then | ||
echo "failed to determine Ubuntu codename" | ||
return 1 | ||
fi | ||
if `test x$UBUNTU_CODENAME = x`; then | ||
echo "failed to determine ROS version" | ||
return 1 | ||
fi | ||
|
||
git submodule update --init --recursive | ||
|
||
sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu $UBUNTU_CODENAME main\" > /etc/apt/sources.list.d/ros-latest.list" | ||
wget http://packages.ros.org/ros.key -O - | sudo apt-key add - | ||
|
||
sudo apt-get update -qq | ||
|
||
sudo apt-get install -qq \ | ||
doxygen doxygen-latex \ | ||
libboost-all-dev \ | ||
libeigen3-dev \ | ||
liblapack-dev \ | ||
libblas-dev \ | ||
gfortran \ | ||
python-dev \ | ||
python-sphinx \ | ||
python-numpy \ | ||
libbullet-dev | ||
|
||
|
||
sudo apt-get install -qq \ | ||
ros-$ROS_VERSION-ros-base \ | ||
ros-$ROS_VERSION-ros-control \ | ||
ros-$ROS_VERSION-pr2-mechanism \ | ||
ros-$ROS_VERSION-pr2-controllers \ | ||
ros-$ROS_VERSION-control-msgs \ | ||
ros-$ROS_VERSION-tf \ | ||
ros-$ROS_VERSION-resource-retriever \ | ||
ros-$ROS_VERSION-urdf \ | ||
ros-$ROS_VERSION-urdfdom-py \ | ||
ros-$ROS_VERSION-common-msgs \ | ||
ros-$ROS_VERSION-rosdoc-lite \ | ||
ros-$ROS_VERSION-robot-state-publisher \ | ||
ros-$ROS_VERSION-cmake-modules \ | ||
ros-hydro-ros-control \ | ||
ros-hydro-pr2-controllers-msgs | ||
|
||
|
||
sudo rosdep init | ||
rosdep update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/sh | ||
set -ev | ||
|
||
# Directories. | ||
root_dir=`pwd` | ||
build_dir="$root_dir/_travis/build" | ||
install_dir="$root_dir/_travis/install" | ||
|
||
# Shortcuts. | ||
git_clone="git clone --quiet --recursive" | ||
|
||
# Source ROS setup file | ||
. /opt/ros/*/setup.sh | ||
|
||
# Create layout. | ||
rm -rf "$build_dir" "$install_dir" | ||
mkdir -p "$build_dir" | ||
mkdir -p "$install_dir" | ||
|
||
# Setup environment variables. | ||
export LD_LIBRARY_PATH="$install_dir/lib:$LD_LIBRARY_PATH" | ||
export LD_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LD_LIBRARY_PATH" | ||
export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$PKG_CONFIG_PATH" | ||
export PKG_CONFIG_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`/pkgconfig:$PKG_CONFIG_PATH" | ||
|
||
export ROS_PACKAGE_PATH="$root_dir:$ROS_PACKAGE_PATH" | ||
|
||
install_dependency() | ||
{ | ||
echo "--> Compiling $1" | ||
mkdir -p "$build_dir/$1" | ||
cd "$build_dir" | ||
$git_clone "git://github.com/$1" "$1" | ||
cd "$build_dir/$1" | ||
cmake . -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" | ||
make install | ||
} | ||
|
||
install_ros_stack() | ||
{ | ||
echo "--> Compiling $1" | ||
mkdir -p "$build_dir/$1" | ||
cd "$build_dir" | ||
if [ "$#" -eq "2" ]; then | ||
$git_clone "git://github.com/$1" "$1" -b $2 | ||
else | ||
$git_clone "git://github.com/$1" "$1" | ||
fi | ||
export ROS_PACKAGE_PATH="$build_dir/$1:$ROS_PACKAGE_PATH" | ||
} | ||
|
||
# Retrieve jrl-mathtools | ||
install_dependency jrl-umi3218/jrl-mathtools | ||
install_dependency jrl-umi3218/jrl-mal | ||
install_dependency laas/abstract-robot-dynamics | ||
install_dependency jrl-umi3218/jrl-dynamics | ||
install_dependency stack-of-tasks/dynamic-graph | ||
install_dependency stack-of-tasks/dynamic-graph-python | ||
install_dependency stack-of-tasks/sot-core | ||
install_dependency stack-of-tasks/sot-tools | ||
install_dependency stack-of-tasks/sot-dynamic | ||
install_dependency laas/jrl_dynamics_urdf | ||
install_ros_stack stack-of-tasks/redundant_manipulator_control | ||
|
||
cd "$root_dir" | ||
# build dependencies | ||
rosdep install dynamic_graph_bridge_msgs | ||
rosmake dynamic_graph_bridge_msgs | ||
|
||
rosdep install dynamic_graph_bridge | ||
rosmake dynamic_graph_bridge | ||
cd "$build_dir" | ||
cd stack-of-tasks/redundant_manipulator_control/dynamic_graph_bridge/build | ||
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" | ||
rosmake dynamic_graph_bridge | ||
make install | ||
|
||
|
||
# rosmake and install sot_pr2 | ||
cd "$root_dir" | ||
export ROS_PACKAGE_PATH="$root_dir:$ROS_PACKAGE_PATH" | ||
rosdep install sot_pr2 | ||
rosmake sot_pr2 | ||
cd build | ||
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" | ||
rosmake sot_pr2 | ||
make install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule cmake
updated
54 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<library path="lib/libsot_pr2"> | ||
<class name="sot_pr2/Pr2SotControllerPlugin" | ||
type="sot_pr2::Pr2SotController" | ||
type="sot_pr2::Pr2ControllerPlugin" | ||
base_class_type="pr2_controller_interface::Controller" /> | ||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#ifndef PR2_CONTROLLER_PLUGIN_H | ||
#define PR2_CONTROLLER_PLUGIN_H | ||
|
||
#include <pr2_controller_interface/controller.h> | ||
#include <pr2_mechanism_model/joint.h> | ||
#include <sot_pr2/pr2_threaded_sot_controller.h> | ||
#include <control_toolbox/pid.h> | ||
#include <boost/scoped_ptr.hpp> | ||
#include <realtime_tools/realtime_publisher.h> | ||
#include <control_msgs/JointTrajectoryControllerState.h> | ||
#include <tf/transform_listener.h> | ||
#include <actionlib/client/simple_action_client.h> | ||
#include <pr2_controllers_msgs/Pr2GripperCommandAction.h> | ||
|
||
namespace sot_pr2 { | ||
|
||
typedef boost::shared_ptr<pr2_mechanism_model::JointState> Pr2JointPtr; | ||
|
||
class Pr2ControllerPlugin : public pr2_controller_interface::Controller { | ||
public: | ||
explicit Pr2ControllerPlugin(); | ||
virtual ~Pr2ControllerPlugin(); | ||
|
||
virtual bool init(pr2_mechanism_model::RobotState *robot, | ||
ros::NodeHandle &n); | ||
virtual void starting(); | ||
virtual void update(); | ||
virtual void stopping(); | ||
|
||
private: | ||
void fillSensors(); | ||
void readControl(); | ||
|
||
private: | ||
// SoT Controller | ||
Pr2ThreadedSotController sot_controller_; | ||
SensorMap sensorsIn_; | ||
ControlMap controlValues_; | ||
|
||
std::vector<double> joint_encoder_; | ||
std::vector<double> joint_velocity_; | ||
std::vector<double> joint_control_; | ||
std::vector<double> error_raw; | ||
std::vector<double> error; | ||
|
||
|
||
// Pr2 Controller | ||
int loop_count_; | ||
ros::Time last_time_; | ||
std::vector<Pr2JointPtr> joints_; | ||
std::vector<control_toolbox::Pid> pids_; | ||
pr2_mechanism_model::RobotState *robot_; | ||
|
||
// Gripper | ||
actionlib::SimpleActionClient<pr2_controllers_msgs::Pr2GripperCommandAction> *r_gripper_client_; | ||
actionlib::SimpleActionClient<pr2_controllers_msgs::Pr2GripperCommandAction> *l_gripper_client_; | ||
double r_gripper_position; | ||
double l_gripper_position; | ||
|
||
// ROS interface | ||
//ros::NodeHandle node_; | ||
boost::scoped_ptr< | ||
realtime_tools::RealtimePublisher< | ||
control_msgs::JointTrajectoryControllerState> > controller_state_publisher_; | ||
|
||
ros::Publisher cmd_vel_pub_; | ||
|
||
tf::TransformListener listener_; | ||
|
||
double timeFromStart_; | ||
|
||
int _iter; | ||
double _mean; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.