From a6712c70d2cc6c1346b707a4183e3a89dec98ae7 Mon Sep 17 00:00:00 2001 From: Rohan Agrawal Date: Sat, 8 Jul 2017 19:13:09 -0700 Subject: [PATCH 1/3] remove old tmp files --- launch/speech.launch~ | 9 --------- launch/testspeech.launch~ | 9 --------- msg/paramdump.msg~ | 0 scripts/.paramdump.py.swp | Bin 12288 -> 0 bytes scripts/gains.yaml | 2 -- 5 files changed, 20 deletions(-) delete mode 100644 launch/speech.launch~ delete mode 100644 launch/testspeech.launch~ delete mode 100644 msg/paramdump.msg~ delete mode 100644 scripts/.paramdump.py.swp delete mode 100644 scripts/gains.yaml diff --git a/launch/speech.launch~ b/launch/speech.launch~ deleted file mode 100644 index f543474..0000000 --- a/launch/speech.launch~ +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/launch/testspeech.launch~ b/launch/testspeech.launch~ deleted file mode 100644 index 75819b8..0000000 --- a/launch/testspeech.launch~ +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/msg/paramdump.msg~ b/msg/paramdump.msg~ deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/.paramdump.py.swp b/scripts/.paramdump.py.swp deleted file mode 100644 index e4cc16a77d1bda1353ccc6fface225cb86ad591f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2J#P~+7{}d;r4j`M60A?tq9kg1SKd@qsS6TF9hj_hZK*ukv7s%J(8NWYrDbM9n-t18d)O10 z!Ep)sIU8UDCo@pG&cf~K^&8i(E&2howHdl}as6atIf@Oi0XDz}*Z><~18jf|uz~-= zfHM=~DJq#9RWmngC;n<~1E{;0O2)zJagc3)lyrz(?=`Y=SG`GMEDU=Y;qG-h+4GHP{1Bz!JCx z=D;kN1QXyb=6?g8fdV`R8{i(O)^-Zr@{-vA8(;%$fDNz#Hoykh02?^v1_;-|spUpf zs18NqU!74NXEKUtWrgZdl*Kso9MzXa6(G6UDs zIdux1k=#{I%fzc{=HW?y!V$Pc=VYO=rnz@-;xU^iqcg zq?3hhp|7-r_30hIC5Xs;cw3UeV`ZJpT`=?Y8vb39oHEScNa@7+j!iQDWQ^?u(U Date: Sat, 8 Jul 2017 19:13:58 -0700 Subject: [PATCH 2/3] remove custom message --- CMakeLists.txt | 18 ++++++++---------- msg/paramdump.msg | 2 -- 2 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 msg/paramdump.msg diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ca7147..79a56ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,6 @@ project(paramdump) find_package(catkin REQUIRED COMPONENTS rospy std_msgs - message_generation ) ## System dependencies are found with CMake's conventions @@ -44,10 +43,9 @@ find_package(catkin REQUIRED COMPONENTS ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) ## Generate messages in the 'msg' folder -add_message_files( - FILES - paramdump.msg -) +#add_message_files( +# FILES +#) ## Generate services in the 'srv' folder # add_service_files( @@ -64,10 +62,10 @@ add_message_files( # ) ## Generate added messages and services with any dependencies listed here -generate_messages( - DEPENDENCIES - paramdump -) +#generate_messages( +# DEPENDENCIES +# paramdump +#) ################################################ ## Declare ROS dynamic reconfigure parameters ## @@ -103,7 +101,7 @@ catkin_package( # LIBRARIES paramdump # CATKIN_DEPENDS rospy std_msgs # DEPENDS system_lib - CATKIN_DEPENDS message_runtime +# CATKIN_DEPENDS message_runtime ) ########### diff --git a/msg/paramdump.msg b/msg/paramdump.msg deleted file mode 100644 index de7097c..0000000 --- a/msg/paramdump.msg +++ /dev/null @@ -1,2 +0,0 @@ -string data - From e588ceed930ff4a5ddc8eb8d25811444eba1d404 Mon Sep 17 00:00:00 2001 From: Rohan Agrawal Date: Sat, 8 Jul 2017 19:44:22 -0700 Subject: [PATCH 3/3] cleanup code to use std_srvs/Trigger service --- scripts/paramdump.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) mode change 100644 => 100755 scripts/paramdump.py diff --git a/scripts/paramdump.py b/scripts/paramdump.py old mode 100644 new mode 100755 index 9dd0e15..61aa813 --- a/scripts/paramdump.py +++ b/scripts/paramdump.py @@ -1,34 +1,34 @@ #!/usr/bin/env python -## Simple program that listens to std_msgs/Strings published -## to the 'paramdump' topic. Upon receiving one that says "dump waypoints", it executes -## the rosparam command to dump the waypoint parameters. This allows them to be persistent. +## Simple program that listens to std_srv/Trigger messages +## on the /save_waypoints service. Upon receiving one it calles +## the rosparam command to save the waypoint parameters to a file. +## Waypoints are currently saved to ~/waypoints.yaml import rospy import subprocess -from std_msgs.msg import String +from std_srvs.srv import Trigger +from std_srvs.srv import TriggerResponse from os.path import expanduser -def callback(data): - # rospy.loginfo(rospy.get_caller_id() + ' I heard %s', data.data) +def save_waypoints(req): + try: + home = expanduser("~") + subprocess.check_output( + ["rosparam", "dump", home + "/waypoints.yaml", "/waypoint"], + stderr=subprocess.STDOUT + ) + # parameter -v after "dump" will give verbose output + except subprocess.CalledProcessError as cpe: + return TriggerResponse(False, "Error saving waypoints: %s" % cpe.output) - if data.data == "dump waypoints": - home = expanduser("~") - subprocess.call(["rosparam", "dump", home + "/waypoints.yaml", "/waypoint"]) - # parameter -v after "dump" will give verbose output - -def paramdump(): - - # rospy.loginfo(rospy.get_caller_id() + 'paramdump is running') + return TriggerResponse(True, "") +if __name__ == '__main__': rospy.init_node('paramdump') + rospy.Service('save_waypoints', Trigger, save_waypoints) - rospy.Subscriber('paramdump', String, callback) - - # spin() simply keeps python from exiting until this node is stopped rospy.spin() -if __name__ == '__main__': - paramdump()