ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I ran into the same issue and ended up creating this script
takes as arguments the new .yaml file to append and the namespace (if there's no namespace, the simple rosparam load command is executed)
Example:
rosparam_append [path/to/your].yaml /[your_namespace]
you can use this script in your launch file following this answer
remember to give executable permissions to the script with:
chmod 755 rosparam_append
hope it helps
2 | No.2 Revision |
I ran into the same issue and ended up creating this script
script:
#!/bin/bash
# $0 is the script name, $1 id the first ARG, $2 is second...
if [ "$2" = "" ]
then
echo "Usage: $0 <filename> <namespace>"
else
dump_command="rosparam dump"
load_command="rosparam load"
FILE="$1"
NAMESPACE="$2"
IS_NAMESPACE=$(rosparam list | /bin/egrep "$NAMESPACE")
if [ -z "$IS_NAMESPACE" ];
then
echo "No previous Namespace found, simply loading new parameters"
command="$load_command $FILE $NAMESPACE"
eval $command
else
#Dumps the current parameters in the server
command="$dump_command dump_tmp.txt $NAMESPACE"
eval $command
#Temporarly loads the new parameters
command="$load_command $FILE $NAMESPACE"
eval $command
#Dumps the new parameters
command="$dump_command load_tmp.txt $NAMESPACE"
eval $command
#Appends both files
cat dump_tmp.txt >> load_tmp.txt
#Loads all the new parameters
command="$load_command load_tmp.txt $NAMESPACE"
eval $command
#Remove temporary files
rm load_tmp.txt
rm dump_tmp.txt
fi
fi
I called this script file "rosparam_append" and it takes as arguments the new .yaml file to append and the namespace (if there's no namespace, the simple rosparam load command is executed)
Example:
rosparam_append [path/to/your].yaml /[your_namespace]
you can use this script in your launch file following (from this answer
<node name = "rosparam_append_node"
pkg = "your-package-name"
type = "rosparam_append"
args = "$(find your-package-name)/path/to/your.yaml /your/namespace"/>
remember to give executable permissions to the script with:
chmod 755 rosparam_append
hope it helps