Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groovy #2

Open
wants to merge 33 commits into
base: groovy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2355ac8
Use stand-alone version of jrl-synamics-urdf.
Jan 8, 2014
41c8090
Use a dictionary to specify joint mapping.
Jan 22, 2014
72169db
Remove method initializePr2.
Jan 22, 2014
4338bd2
Reintroduce left-ankle, correct the wrist/gripper frames.
Jan 30, 2014
e47ed46
Cleanup prologue.
Jan 30, 2014
82e3b07
Add tasks in pr2 tasks, homogenize solver initialization.
Jan 30, 2014
cdb74bc
Add a simple test for the pr2, to check the position of the end effec…
Jan 30, 2014
f03b534
Small correction of the scripts
Jan 30, 2014
1051389
Correct the display launch file.
Jan 30, 2014
44622ab
Synchronize.
Feb 16, 2014
c08c204
Change the prototype of the pr2 controller.
Feb 16, 2014
1b16b11
Change the way the contact task is loaded.
Feb 16, 2014
b47d21b
Install libsot_pr2.
Feb 18, 2014
e9ba362
Remove tmp files.
Feb 18, 2014
f98d776
Complete gitignore.
Feb 18, 2014
8935053
Correct the name of the device in the python file.
Feb 18, 2014
6cac871
Error catching more verbose.
Feb 18, 2014
bb77235
Some of the joints can be ignored.
Feb 21, 2014
4d1db9e
Remove useless joints.
Feb 21, 2014
b7442db
Remove the Joint limit tasks. It has been replaced by the JointLimita…
Feb 21, 2014
0f353eb
Cleanup the CMake file.
Feb 21, 2014
2830961
Update the test script to add functions/the root definition.
Feb 23, 2014
2e20d6c
Revert "Some of the joints can be ignored."
Feb 24, 2014
08ed846
Move the SoT Execution in a thread
Feb 25, 2014
b03f213
Revert "Remove the Joint limit tasks. It has been replaced by the Joi…
Feb 21, 2014
d2ba479
Merge branch 'groovy' of https://github.com/francois-keith/sot_pr2 in…
Feb 26, 2014
5e811d5
Clean the demo script controller_test_2.py
Feb 26, 2014
b116edc
Add a task to control the contribution of each joint, and reduce the …
Feb 26, 2014
0a39340
Complete pr2_sot_demo.py
Feb 26, 2014
23dd55d
Merge branch 'groovy' of github.com:francois-keith/sot_pr2 into groovy
Feb 26, 2014
09cfb94
Add missing function export.
Feb 26, 2014
75c7559
Cleanup manifest.xml
Mar 28, 2014
3a35b02
[Travis] Add travis test.
Mar 27, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ src/lisp/
src/sot_pr2/
srv/lisp/
srv_gen/

*~
*.cfgc
14 changes: 14 additions & 0 deletions .travis.yml
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
6 changes: 6 additions & 0 deletions .travis/after_success
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]"

56 changes: 56 additions & 0 deletions .travis/before_install
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
set -ev

export UBUNTU_CODENAME=`lsb_release -s -c`
export ROS_VERSION=groovy

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-common-rosdeps \
ros-$ROS_VERSION-bullet \
ros-$ROS_VERSION-ros-realtime \
ros-$ROS_VERSION-tf \
ros-$ROS_VERSION-resource-retriever \
ros-$ROS_VERSION-urdf \
ros-$ROS_VERSION-urdf-interface \
ros-$ROS_VERSION-common-msgs \
ros-$ROS_VERSION-rosdoc-lite

sudo rosdep init
rosdep update
88 changes: 88 additions & 0 deletions .travis/build
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 groovy

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

26 changes: 26 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

include(cmake/base.cmake)
include(cmake/python.cmake)
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR lib)
endif()
include(cmake/GNUInstallDirs.cmake)

set(ROS_BUILD_TYPE RelWithDebInfo)

Expand All @@ -17,10 +21,19 @@ ADD_REQUIRED_DEPENDENCY("jrl-mal")
ADD_REQUIRED_DEPENDENCY("dynamic-graph")
ADD_REQUIRED_DEPENDENCY("dynamic-graph-python")
ADD_REQUIRED_DEPENDENCY("sot-core")
ADD_REQUIRED_DEPENDENCY("jrl-dynamics-urdf >= 2.0.1-14")

# This is required by the Python prologue.
ADD_REQUIRED_DEPENDENCY("sot-dynamic")


# Handle rpath necessary to handle ROS multiplace packages
# libraries inclusion
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Python
INCLUDE(cmake/python.cmake)
FINDPYTHON()
Expand All @@ -29,11 +42,13 @@ LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS})

set(SOURCES
src/pr2_controller_plugin.cpp
src/pr2_threaded_sot_controller.cpp
src/pr2_sot_controller.cpp
src/pr2_device.cpp)

set(HEADERS
include/sot_pr2/pr2_controller_plugin.h
include/sot_pr2/pr2_threaded_sot_controller.h
include/sot_pr2/pr2_sot_controller.h
include/sot_pr2/pr2_device.h)

Expand All @@ -42,6 +57,17 @@ rosbuild_add_library(sot_pr2 ${HEADERS} ${SOURCES})
PKG_CONFIG_USE_DEPENDENCY(sot_pr2 "dynamic-graph")
PKG_CONFIG_USE_DEPENDENCY(sot_pr2 "sot-core")
PKG_CONFIG_USE_DEPENDENCY(sot_pr2 "dynamic-graph-python")
PKG_CONFIG_USE_DEPENDENCY(sot_pr2 "jrl-dynamics-urdf")
install(TARGETS sot_pr2 DESTINATION ${CMAKE_INSTALL_LIBDIR})

rosbuild_add_executable(sot_pr2_fake_controller ${HEADERS} src/fake_controller.cpp)
PKG_CONFIG_USE_DEPENDENCY(sot_pr2_fake_controller "dynamic-graph")
PKG_CONFIG_USE_DEPENDENCY(sot_pr2_fake_controller "sot-core")
PKG_CONFIG_USE_DEPENDENCY(sot_pr2_fake_controller "dynamic-graph-python")
PKG_CONFIG_USE_DEPENDENCY(sot_pr2_fake_controller "jrl-dynamics-urdf")
target_link_libraries(sot_pr2_fake_controller sot_pr2)
install(TARGETS sot_pr2_fake_controller DESTINATION ${CMAKE_INSTALL_LIBDIR})

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(python)

15 changes: 13 additions & 2 deletions include/sot_pr2/pr2_controller_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

#include <pr2_controller_interface/controller.h>
#include <pr2_mechanism_model/joint.h>
#include <sot_pr2/pr2_sot_controller.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 {

Expand All @@ -31,7 +33,7 @@ class Pr2ControllerPlugin : public pr2_controller_interface::Controller {

private:
// SoT Controller
Pr2SotController sot_controller_;
Pr2ThreadedSotController sot_controller_;
SensorMap sensorsIn_;
ControlMap controlValues_;

Expand All @@ -49,6 +51,12 @@ class Pr2ControllerPlugin : public pr2_controller_interface::Controller {
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<
Expand All @@ -60,6 +68,9 @@ class Pr2ControllerPlugin : public pr2_controller_interface::Controller {
tf::TransformListener listener_;

double timeFromStart_;

int _iter;
double _mean;
};

}
Expand Down
1 change: 1 addition & 0 deletions include/sot_pr2/pr2_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace sot_pr2 {
void cleanupSetSensors(SensorMap &sensorsIn);

void getControl(ControlMap &controlOut);
void getFakeControl(ControlMap &controlOut);

protected:
void updateRobotState(const std::vector<double> &anglesIn);
Expand Down
2 changes: 1 addition & 1 deletion include/sot_pr2/pr2_sot_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Pr2SotController : public dynamicgraph::sot::AbstractSotExternalInterface
static const std::string LOG_PYTHON;

public:
explicit Pr2SotController(std::string name);
explicit Pr2SotController();
virtual ~Pr2SotController();

void setupSetSensors(SensorMap &sensorsIn);
Expand Down
51 changes: 51 additions & 0 deletions include/sot_pr2/pr2_threaded_sot_controller.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef PR2_SOT_CONTROLLER_H
#define PR2_SOT_CONTROLLER_H

#include <sot_pr2/pr2_device.h>
#include <dynamic_graph_bridge/ros_interpreter.hh>
#include <sot/core/abstract-sot-external-interface.hh>

namespace sot_pr2 {

class Pr2ThreadedSotController : public dynamicgraph::sot::AbstractSotExternalInterface
{
public:
static const std::string LOG_PYTHON;

public:
explicit Pr2ThreadedSotController();
virtual ~Pr2ThreadedSotController();

void init();

void setupSetSensors(SensorMap &sensorsIn);
void nominalSetSensors(SensorMap &sensorsIn);
void cleanupSetSensors(SensorMap &sensorsIn);

void getControl(ControlMap &controlOut);

boost::shared_ptr<dynamicgraph::Interpreter> interpreter_;
ros::NodeHandle node_;

protected:
void runPython(std::ostream &file,
const std::string &command,
dynamicgraph::Interpreter &interpreter);

virtual void startupPython();

private:
Pr2Device device_;

SensorMap _holdIn;
ControlMap _holdOut;

public:
Pr2Device *device() {return &device_;}
SensorMap &holdIn() {return _holdIn;}
ControlMap &holdOut() {return _holdOut;}
};

}

#endif
4 changes: 2 additions & 2 deletions launch/display.launch
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<param name="robot_base_link" value="base_footprint"/>
<!--<param name="ref_link" value="odom_combined"/>-->

<arg name="frame" value="base_footprint"/>
<arg name="child_frame" value="odom"/>
<arg name="frame" value="odom"/>
<arg name="child_frame" value="base_footprint"/>

<node name="robot_pose_publisher" pkg="sot_pr2" type="robot_pose_publisher" args="_frame:=$(arg frame) _child_frame:=$(arg child_frame)">
<env name="ROS_NAMESPACE" value="/dynamic_graph" />
Expand Down
13 changes: 5 additions & 8 deletions launch/gazebo.launch
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<launch>
<include file="$(find gazebo_worlds)/launch/empty_world.launch"/>
<include file="$(find sot_pr2)/launch/pr2_empty_world.launch">
<arg name="use_sim_time" value="true" />
<arg name="throttled" default="false"/>
<arg name="physics" default="true"/>
</include>

<!-- Startup PR2 without any mechanism controllers -->
<include file="$(find sot_pr2)/launch/spawn_pr2.launch"/>
Expand All @@ -8,12 +12,5 @@
<env name="ROS_NAMESPACE" value="/dynamic_graph"/>
</node>-->

<!--<rosparam file="$(find pr2_controller_configuration_gazebo)/pr2_base_controller.yaml" command="load" />
<rosparam file="$(find pr2_controller_configuration_gazebo)/pr2_odometry.yaml" command="load" />
<node name="pr2_base_controllers_spawner" pkg="pr2_controller_manager" type="spawner" output="screen"
args="--wait-for=/calibrated base_controller base_odometry" />-->

<include file="$(find sot_pr2)/launch/spawn_pr2_controller.launch" />

</launch>

Loading