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

add simple package to dyn reconfigure move_base via yaml files #58

Merged
merged 1 commit into from
Apr 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
140 changes: 140 additions & 0 deletions param_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
cmake_minimum_required(VERSION 2.8.3)
project(param_loader)

## 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
dynamic_reconfigure
rospy
)

## 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 and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependencies might have been
## pulled in transitively but can be declared for certainty nonetheless:
## * add a build_depend tag for "message_generation"
## * 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
# )

###################################
## 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 param_loader
# CATKIN_DEPENDS dynamic_reconfigure rospy
# 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 cpp library
# add_library(param_loader
# src/${PROJECT_NAME}/param_loader.cpp
# )

## Declare a cpp executable
# add_executable(param_loader_node src/param_loader_node.cpp)

## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(param_loader_node param_loader_generate_messages_cpp)

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

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

install(
DIRECTORY config
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

install(PROGRAMS scripts/param_loader.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

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

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_param_loader.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)
41 changes: 41 additions & 0 deletions param_loader/config/current_dwa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#see http://ros.org/wiki/dwa_local_planner?distro=groovy for param description
DWAPlannerROS:
#default 2.5 -> with this value the robot sometimes gets to close to the wall when leaving a goal position in narrow corridors, causing dwa planner to have problems
acc_lim_x: 1.0

acc_lim_y: 0.0

#default 3.2
acc_lim_theta: 2.0

min_vel_y: 0.0
max_vel_y: 0.0
max_rot_vel: 1.0
min_rot_vel: 0.4

yaw_goal_tolerance: 0.1

#default:0.1 -> with this value the robot sometimes has troubles achieving the goal, due to low tolerance
xy_goal_tolerance: 0.1


# if the robot ever reaches the goal xy location it will simply rotate in place, even if it ends up outside the goal tolerance while it is doing so.
#latch_xy_goal_tolerance: true


sim_time: 2.1


#cost = path_distance_bias * (distance to path from the endpoint of the trajectory in meters) + goal_distance_bias * (distance to local goal from the endpoint of the trajectory in meters) + occdist_scale * (maximum obstacle cost along the trajectory in obstacle cost (0-254))
path_distance_bias: 32.0 #default:32, previous:5
goal_distance_bias: 24.0 #default:24, previous:9
occdist_scale: 0.01 #default:0.01


oscillation_reset_dist: 0.05


prune_plan: true

#holonomic_robot: false

37 changes: 37 additions & 0 deletions param_loader/config/lincoln_dwa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
DWAPlannerROS:
acc_lim_theta: 3.2
acc_lim_x: 1.0
acc_lim_y: 0.0
acc_limit_trans: 0.1
angular_sim_granularity: 0.1
forward_point_distance: 0.325
goal_distance_bias: 9.0
#holonomic_robot: false
#latch_xy_goal_tolerance: true
max_rot_vel: 1.0
max_scaling_factor: 0.2
max_trans_vel: 0.55
max_vel_x: 0.55
max_vel_y: 0.0
min_rot_vel: 0.2
min_trans_vel: 0.0
min_vel_x: 0.0
min_vel_y: 0.0
occdist_scale: 0.01
oscillation_reset_angle: 0.2
oscillation_reset_dist: 0.05
path_distance_bias: 5.0
prune_plan: true
restore_defaults: false
rot_stopped_vel: 0.1
scaling_speed: 0.25
sim_granularity: 0.025
sim_time: 1.7
stop_time_buffer: 0.2
trans_stopped_vel: 0.0
use_dwa: true
vth_samples: 20
vx_samples: 3
vy_samples: 10
xy_goal_tolerance: 0.3
yaw_goal_tolerance: 0.1
54 changes: 54 additions & 0 deletions param_loader/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0"?>
<package>
<name>param_loader</name>
<version>0.0.19</version>
<description>The param_loader package</description>

<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
<maintainer email="[email protected]">Bruno Lacerda</maintainer>


<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>MIT</license>


<!-- Url tags are optional, but mutiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/param_loader</url> -->


<!-- Author tags are optional, mutiple are allowed, one per tag -->
<!-- Authors do not have to be maintianers, but could be -->
<!-- Example: -->
<!-- <author email="[email protected]">Jane Doe</author> -->


<!-- The *_depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<!-- <run_depend>message_runtime</run_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>dynamic_reconfigure</build_depend>
<build_depend>rospy</build_depend>
<run_depend>dynamic_reconfigure</run_depend>
<run_depend>rospy</run_depend>


<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->

</export>
</package>
31 changes: 31 additions & 0 deletions param_loader/scripts/param_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#! /usr/bin/env python

import sys
import yaml
import rospy
import dynamic_reconfigure.client


if __name__ == '__main__':
rospy.init_node('param_loader')

filtered_argv=rospy.myargv(argv=sys.argv)

if len(filtered_argv)<2:
rospy.logwarn("No config yaml file provided.")
elif len(filtered_argv)>2:
rospy.logwarn("Too many arguments.")
else:
file_name=filtered_argv[1]


with open(file_name, 'r') as stream:
yaml_config=yaml.load(stream)
print yaml_config
for key, val in yaml_config.iteritems():
print key
print val
client = dynamic_reconfigure.client.Client("/move_base/" + key)
client.update_configuration(val)
print "UPDATED"