Skip to content

Commit

Permalink
added code base
Browse files Browse the repository at this point in the history
  • Loading branch information
pfmark committed Nov 30, 2018
1 parent 87477c1 commit 3562280
Show file tree
Hide file tree
Showing 151 changed files with 12,007 additions and 2 deletions.
197 changes: 197 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
cmake_minimum_required(VERSION 2.8.3)
project(reinforcement_learning_navigation)

## Add support for C++11, supported in ROS Kinetic and newer
# add_definitions(-std=c++11)

## 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

)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## 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()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# std_msgs # Or other packages containing msgs
# )

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES reinforcement_learning_navigation
# CATKIN_DEPENDS ridgeback_gazebo ridgeback_navigation
# DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/reinfocement_learning_navigation.cpp
# )

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/reinforcement_learning_navigaation_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_reinfocement_learning_navigation.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
## Reinforced Imitation Open Source Repo
Stay tuned! We are currently preparing our code for open-sourcing.
Reinforced Imitation
====================

This repository contains the tensorflow implementation for training a reinforcement learning based map-less navigation model, as described in the paper:\
[Reinforced Imitation: Sample Efficient Deep Reinforcement Learning for Map-less Navigation by Leveraging Prior Demonstrations](https://arxiv.org/abs/1805.07095)

# Requirements
1. Ubuntu
2. Python 2.7
3. [ROS Indigo](http://wiki.ros.org/indigo) or [ROS Kinetic](http://wiki.ros.org/kinetic)
4. Stage-ros simulator, with `add_pose_sub` enabled. Can be found in this [branch](https://github.com/ros-simulation/stage_ros/tree/add_pose_sub) of the repository.

# Training the Model
1. First run the stage simulator:
`roslaunch reinforcement_learning_navigation stage_sim.launch`
2. In a separate terminal, run the training code:
`rosrun reinforcement_learning_navigation train_cpo.py --output_name $experiment_name$`\
In order to use pre-trained weights from imitation learning, add the arguments `--jump_start 1 --model_init $path_to_policy_weights$`

# Citation
If you use our code in your research, please cite our paper.
```
@ARTICLE{pfeiffer2018ral,
author={M. Pfeiffer and S. Shukla and M. Turchetta and C. Cadena Lerma and A. Krause and R. Siegwart and J. Nieto},
journal={IEEE Robotics and Automation Letters},
title={{Reinforced Imitation: Sample Efficient Deep Reinforcement Learning for Map-less Navigation by Leveraging Prior Demonstrations}},
year={2018},
volume={3},
number={4},
pages={4423-4430}
}
```

# References
Our training model uses Constrained Policy Optimization : \[[Paper](https://arxiv.org/abs/1705.10528)\] \[[Code](https://github.com/jachiam/cpo)\]
6 changes: 6 additions & 0 deletions README.md~
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<<<<<<< HEAD
## Reinforce Imitation Open Source Repo
=======
## Reinforced Imitation Open Source Repo
>>>>>>> origin/fix/name
Stay tuned! We are currently preparing our code for open-sourcing.
4 changes: 4 additions & 0 deletions initial_weights/simple_model/checkpoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
model_checkpoint_path: "final"
all_model_checkpoint_paths: "snap-40000"
all_model_checkpoint_paths: "snap-80000"
all_model_checkpoint_paths: "final"
Binary file not shown.
Binary file not shown.
Binary file added initial_weights/simple_model/final.index
Binary file not shown.
Binary file added initial_weights/simple_model/final.meta
Binary file not shown.
Binary file added initial_weights/simple_model/graph.pb
Binary file not shown.
Binary file added initial_weights/simple_model/model.pb
Binary file not shown.
Binary file not shown.
Binary file added initial_weights/simple_model/snap-40000.index
Binary file not shown.
Binary file added initial_weights/simple_model/snap-40000.meta
Binary file not shown.
Binary file not shown.
Binary file added initial_weights/simple_model/snap-80000.index
Binary file not shown.
Binary file added initial_weights/simple_model/snap-80000.meta
Binary file not shown.
Binary file not shown.
84 changes: 84 additions & 0 deletions launch/stage_sim.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!--
Turtlebot navigation simulation:
- stage
- map_server
- move_base
- static map
- amcl
- rviz view
-->
<launch>
<arg name="base" default="$(optenv TURTLEBOT_BASE kobuki)"/> <!-- create, rhoomba -->
<arg name="stacks" default="$(optenv TURTLEBOT_STACKS hexagons)"/> <!-- circles, hexagons -->
<arg name="3d_sensor" default="$(optenv TURTLEBOT_3D_SENSOR kinect)"/> <!-- kinect, asus_xtion_pro -->

<!-- Name of the map to use (without path nor extension) and initial position -->
<arg name="map_file" default="$(find reinforcement_learning_navigation)/maps/train_env.yaml "/> <!-- robopark_plan -->
<arg name="world_file" default="$(find reinforcement_learning_navigation)/maps/stage/train_env.world"/>
<arg name="initial_pose_x" default="0.0"/>
<arg name="initial_pose_y" default="0.0"/>
<arg name="initial_pose_a" default="0.0"/>

<param name="/use_sim_time" value="true"/>
<!-- ******************** Stage ******************** -->
<!--
Publishes transforms:
/base_link -> /base_laser
/base_footprint -> /base_link (identity)
/odom -> base_footprint
Publishes topics:
/odom : odometry data from the simulated odometry
/base_scan : laser data from the simulated laser
/base_pose_ground_truth : the ground truth pose
Parameters:
base_watchdog_timeout : time (s) after receiving the last command on cmd_vel before stopping the robot
Args:
-g : run in headless mode.
-->
<node pkg="stage_ros" type="stageros" name="stageros" args="-g $(arg world_file)" respawn="true">
<param name="base_watchdog_timeout" value="0.2"/>
<remap from="odom" to="odom"/>
<remap from="base_pose_ground_truth" to="base_pose_ground_truth"/>
<!--remap from="cmd_vel" to="mobile_base/commands/velocity"/-->
<!--remap from="base_scan" to="scan"/-->
<!--remap from="base_scan_0" to="front/scan"/-->
<!--remap from="base_scan_1" to="rear/scan"/-->
</node>


<!-- ***************** Robot Model ***************** -->
<include file="$(find turtlebot_bringup)/launch/includes/robot.launch.xml">
<arg name="base" value="$(arg base)" />
<arg name="stacks" value="$(arg stacks)" />
<arg name="3d_sensor" value="$(arg 3d_sensor)" />
</include>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<param name="use_gui" value="false"/>
</node>

<!-- Command Velocity multiplexer -->
<node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>
<node pkg="nodelet" type="nodelet" name="cmd_vel_mux" args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager">
<param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml"/>
<remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity"/>
</node>

<!-- ************** Navigation *************** -->
<!--include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml"/-->

<!-- ****** Maps ***** -->
<!--node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)"-->
<!--param name="frame_id" value="/map"/-->
<!--/node-->

<!--include file="$(find turtlebot_navigation)/launch/includes/amcl/amcl.launch.xml"-->
<!--arg name="scan_topic" value="scan"/-->
<!--arg name="use_map_topic" value="true"/-->
<!--arg name="initial_pose_x" value="$(arg initial_pose_x)"/-->
<!--arg name="initial_pose_y" value="$(arg initial_pose_y)"/-->
<!--arg name="initial_pose_a" value="$(arg initial_pose_a)"/-->
<!--/include-->

<!-- **************** Visualisation **************** -->
<!--node name="rviz" pkg="rviz" type="rviz" args="-d $(find turtlebot_stage)/rviz/robot_navigation.rviz"/-->
</launch>
Loading

0 comments on commit 3562280

Please sign in to comment.