diff --git a/param_loader/CMakeLists.txt b/param_loader/CMakeLists.txt new file mode 100644 index 0000000..2766d31 --- /dev/null +++ b/param_loader/CMakeLists.txt @@ -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) diff --git a/param_loader/config/current_dwa.yaml b/param_loader/config/current_dwa.yaml new file mode 100644 index 0000000..fe9a41b --- /dev/null +++ b/param_loader/config/current_dwa.yaml @@ -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 + diff --git a/param_loader/config/lincoln_dwa.yaml b/param_loader/config/lincoln_dwa.yaml new file mode 100644 index 0000000..675ef4c --- /dev/null +++ b/param_loader/config/lincoln_dwa.yaml @@ -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 \ No newline at end of file diff --git a/param_loader/package.xml b/param_loader/package.xml new file mode 100644 index 0000000..daae82f --- /dev/null +++ b/param_loader/package.xml @@ -0,0 +1,54 @@ + + + param_loader + 0.0.19 + The param_loader package + + + + + Bruno Lacerda + + + + + + MIT + + + + + + + + + + + + + + + + + + + + + + + + + + catkin + dynamic_reconfigure + rospy + dynamic_reconfigure + rospy + + + + + + + + \ No newline at end of file diff --git a/param_loader/scripts/param_loader.py b/param_loader/scripts/param_loader.py new file mode 100755 index 0000000..d47f60d --- /dev/null +++ b/param_loader/scripts/param_loader.py @@ -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" +