Skip to content

Commit

Permalink
Merge pull request ApolloAuto#22 from quning78/master
Browse files Browse the repository at this point in the history
Bugfix and Updates for New Packages
  • Loading branch information
quning18 authored Sep 13, 2017
2 parents c24806f + 63f939b commit 59db996
Show file tree
Hide file tree
Showing 179 changed files with 15,114 additions and 454 deletions.
3 changes: 2 additions & 1 deletion ros/class_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ find_package(console_bridge REQUIRED)

if(${catkin_FOUND})
find_package(catkin REQUIRED COMPONENTS cmake_modules)
find_package(Poco REQUIRED COMPONENTS Foundation)
#find_package(Poco REQUIRED COMPONENTS Foundation)
set(Poco_LIBRARIES PocoFoundation)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME} ${Poco_LIBRARIES}
Expand Down
2 changes: 2 additions & 0 deletions ros/dynamic_reconfigure/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyc
build/
1 change: 1 addition & 0 deletions ros/dynamic_reconfigure/.hgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pyc
2 changes: 0 additions & 2 deletions ros/dynamic_reconfigure/.tar

This file was deleted.

10 changes: 5 additions & 5 deletions ros/dynamic_reconfigure/cmake/dynamic_reconfigure-macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ macro(generate_dynamic_reconfigure_options)
if(NOT IS_ABSOLUTE ${_input})
set(_input ${PROJECT_SOURCE_DIR}/${_input})
endif()

# The .cfg file is its own generator.
set(gencfg_build_files
set(gencfg_build_files
${dynamic_reconfigure_BASE_DIR}/templates/ConfigType.py.template
${dynamic_reconfigure_BASE_DIR}/templates/ConfigType.h.template
)
)

get_filename_component(_cfgonly ${_cfg} NAME_WE)
set(_output_cpp ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_INCLUDE_DESTINATION}/${_cfgonly}Config.h)
set(_output_py ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}/cfg/${_cfgonly}Config.py)
set(_output_dox ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/docs/${_cfgonly}Config.dox)
set(_output_wikidoc ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/docs/${_cfgonly}Config.wikidoc)
set(_output_usage ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/docs/${_cfgonly}Config-usage.dox)
set(_output_usage ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/docs/${_cfgonly}Config-usage.dox)

# we need to explicitly add the devel space to the PYTHONPATH
# since it might contain dynamic_reconfigure or Python code of the current package
Expand Down Expand Up @@ -54,7 +54,7 @@ macro(generate_dynamic_reconfigure_options)

add_custom_command(OUTPUT
${_output_cpp} ${_output_dox} ${_output_usage} ${_output_py} ${_output_wikidoc}
COMMAND ${_cmd}
COMMAND ${_cmd}
DEPENDS ${_input} ${gencfg_build_files}
COMMENT "Generating dynamic reconfigure files from ${_cfg}: ${_output_cpp} ${_output_py}"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class ParameterGenerator():
@staticmethod
def dummy(*params, **nparams):
return
return

def __getattr__(self, name):
return self.dummy
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env sh
# generated from dynamic_reconfigure/cmake/setup_custom_pythonpath.sh.in

PYTHONPATH=@CATKIN_DEVEL_PREFIX@/@CATKIN_GLOBAL_PYTHON_DESTINATION@:$PYTHONPATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,42 @@ class ConfigTools
{
return set.bools;
}

static std::vector<dynamic_reconfigure::IntParameter> &getVectorForType(dynamic_reconfigure::Config &set, const int /*val*/)
{
return set.ints;
}

static std::vector<dynamic_reconfigure::StrParameter> &getVectorForType(dynamic_reconfigure::Config &set, const std::string& /*val*/)
{
return set.strs;
}

static std::vector<dynamic_reconfigure::DoubleParameter> &getVectorForType(dynamic_reconfigure::Config &set, const double /*val*/)
{
return set.doubles;
}

static const std::vector<dynamic_reconfigure::BoolParameter> &getVectorForType(const dynamic_reconfigure::Config &set, const bool /*val*/)
{
return set.bools;
}

static const std::vector<dynamic_reconfigure::IntParameter> &getVectorForType(const dynamic_reconfigure::Config &set, const int /*val*/)
{
return set.ints;
}

static const std::vector<dynamic_reconfigure::StrParameter> &getVectorForType(const dynamic_reconfigure::Config &set, const std::string& /*val*/)
{
return set.strs;
}

static const std::vector<dynamic_reconfigure::DoubleParameter> &getVectorForType(const dynamic_reconfigure::Config &set, const double /*val*/)
{
return set.doubles;
}

static dynamic_reconfigure::BoolParameter makeKeyValuePair(const std::string &name, const bool val)
{
dynamic_reconfigure::BoolParameter param;
Expand Down Expand Up @@ -109,7 +109,7 @@ class ConfigTools
}

template<class T>
static void appendGroup(dynamic_reconfigure::Config &set, const std::string &name, int id, int parent, const T &val)
static void appendGroup(dynamic_reconfigure::Config &set, const std::string &name, int id, int parent, const T &val)
{
dynamic_reconfigure::GroupState msg;
msg.name = name;
Expand Down
16 changes: 8 additions & 8 deletions ros/dynamic_reconfigure/include/dynamic_reconfigure/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Author: Blaise Gassend
Handles synchronizing node state with the configuration server, and
Handles synchronizing node state with the configuration server, and
handling of services to get and set configuration.
*/
Expand All @@ -60,7 +60,7 @@ namespace dynamic_reconfigure
/**
* Keeps track of the reconfigure callback function.
*/
template <class ConfigType>
template <class ConfigType>
class Server
{
public:
Expand All @@ -81,7 +81,7 @@ class Server
}

typedef boost::function<void(ConfigType &, uint32_t level)> CallbackType;

void setCallback(const CallbackType &callback)
{
boost::recursive_mutex::scoped_lock lock(mutex_);
Expand Down Expand Up @@ -181,10 +181,10 @@ class Server
boost::recursive_mutex::scoped_lock lock(mutex_);
set_service_ = node_handle_.advertiseService("set_parameters",
&Server<ConfigType>::setConfigCallback, this);

descr_pub_ = node_handle_.advertise<dynamic_reconfigure::ConfigDescription>("parameter_descriptions", 1, true);
descr_pub_.publish(ConfigType::__getDescriptionMessage__());

update_pub_ = node_handle_.advertise<dynamic_reconfigure::Config>("parameter_updates", 1, true);
ConfigType init_config = ConfigType::__getDefault__();
init_config.__fromServer__(node_handle_);
Expand All @@ -210,7 +210,7 @@ class Server
ROS_DEBUG("setCallback did not call callback because it was zero."); /// @todo kill this line.
}

bool setConfigCallback(dynamic_reconfigure::Reconfigure::Request &req,
bool setConfigCallback(dynamic_reconfigure::Reconfigure::Request &req,
dynamic_reconfigure::Reconfigure::Response &rsp)
{
boost::recursive_mutex::scoped_lock lock(mutex_);
Expand All @@ -219,14 +219,14 @@ class Server
new_config.__fromMessage__(req.config);
new_config.__clamp__();
uint32_t level = config_.__level__(new_config);

callCallback(new_config, level);

updateConfigInternal(new_config);
new_config.__toMessage__(rsp.config);
return true;
}

void updateConfigInternal(const ConfigType &config)
{
boost::recursive_mutex::scoped_lock lock(mutex_);
Expand Down
22 changes: 11 additions & 11 deletions ros/dynamic_reconfigure/package.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<package>
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>dynamic_reconfigure</name>
<version>1.5.48</version>
<description>
Expand All @@ -19,18 +21,16 @@

<buildtool_depend version_gte="0.5.87">catkin</buildtool_depend>

<build_depend>boost</build_depend>
<build_depend>message_generation</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>roscpp_serialization</build_depend>
<build_depend>rostest</build_depend>
<build_depend>std_msgs</build_depend>

<run_depend>boost</run_depend>
<run_depend>message_runtime</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>roslib</run_depend>
<run_depend>rospy</run_depend>
<run_depend>rosservice</run_depend>
<run_depend>std_msgs</run_depend>
<depend>boost</depend>
<depend>roscpp</depend>
<depend>std_msgs</depend>

<exec_depend>message_runtime</exec_depend>
<exec_depend>roslib</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>rosservice</exec_depend>
</package>
37 changes: 19 additions & 18 deletions ros/dynamic_reconfigure/scripts/dynparam
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
# POSSIBILITY OF SUCH DAMAGE.
#
# Revision $Id$
from __future__ import print_function

NAME='dynparam'
import roslib; roslib.load_manifest('dynamic_reconfigure')
import rospy
import optparse
import optparse
import sys
import yaml
import dynamic_reconfigure.client
Expand All @@ -46,11 +47,11 @@ def do_list():
connect()
list = dynamic_reconfigure.find_reconfigure_services()
for s in list:
print s
print(s)

def do_set_from_parameters():
usage = """Usage: %prog set_from_parameters [options] node
Example command line:
dynparam set_from_parameters wge100_camera _camera_url:=foo
Expand All @@ -77,7 +78,7 @@ Example launch file:
except KeyError:
print >> sys.stderr, 'error updating parameters: no parameters found on parameter server'
return

set_params(node, params, timeout=options.timeout)

def do_set():
Expand Down Expand Up @@ -120,13 +121,13 @@ Examples:
try:
set_params(node, values_dict, timeout=options.timeout)
except rospy.service.ServiceException:
print 'couldn\'t set parameters at node %s' % node
print('couldn\'t set parameters at node %s' % node)
except rospy.exceptions.ROSException:
print 'couldn\'t set parameters at node %s' % node
print('couldn\'t set parameters at node %s' % node)

def do_get():
usage = "Usage: %prog get [options] node"

parser = optparse.OptionParser(usage=usage, prog=NAME)
add_timeout_option(parser)
options, args = parser.parse_args(myargv[2:])
Expand All @@ -139,11 +140,11 @@ def do_get():
connect()
params = get_params(node, timeout=options.timeout)
if params is not None:
print params
print(params)

def do_load():
usage = "Usage: %prog load [options] node file"

parser = optparse.OptionParser(usage=usage, prog=NAME)
add_timeout_option(parser)
options, args = parser.parse_args(myargv[2:])
Expand All @@ -168,7 +169,7 @@ def do_load():

def do_dump():
usage = "Usage: %prog dump [options] node file"

parser = optparse.OptionParser(usage=usage, prog=NAME)
add_timeout_option(parser)
options, args = parser.parse_args(myargv[2:])
Expand All @@ -179,7 +180,7 @@ def do_dump():
elif len(args) > 2:
parser.error("too many arguments")
node, path = args[0], args[1]

connect()
params = get_params(node, timeout=options.timeout)
if params is not None:
Expand All @@ -190,7 +191,7 @@ def do_dump():
finally:
f.close()

print "couldn't get parameters from node %s" % node
print("couldn't get parameters from node %s" % node)

def get_params(node, timeout=None):
client = dynamic_reconfigure.client.Client(node, timeout=timeout)
Expand All @@ -200,14 +201,14 @@ def set_params(node, params, timeout=None):
client = dynamic_reconfigure.client.Client(node, timeout=timeout)
try:
client.update_configuration(params)
except dynamic_reconfigure.DynamicReconfigureParameterException, e:
print 'error updating parameters: ' + str(e)
except dynamic_reconfigure.DynamicReconfigureParameterException as e:
print('error updating parameters: ' + str(e))

def add_timeout_option(parser):
parser.add_option('-t', '--timeout', action='store', type='float', default=None, help='timeout in secs')
parser.add_option('-t', '--timeout', action='store', type='float', default=None, help='timeout in secs')

def print_usage():
print """dynparam is a command-line tool for getting, setting, and
print("""dynparam is a command-line tool for getting, setting, and
deleting parameters of a dynamically configurable node.
Commands:
Expand All @@ -219,7 +220,7 @@ Commands:
\tdynparam list list configurable nodes
Type dynparam <command> -h for more detailed usage, e.g. 'dynparam get -h'
"""
""")
sys.exit(1)

def connect():
Expand All @@ -230,7 +231,7 @@ if __name__ == '__main__':
if len(myargv) == 1:
print_usage()
else:
cmd = myargv[1]
cmd = myargv[1]
try:
if cmd == 'list': do_list()
elif cmd == 'set_from_parameters': do_set_from_parameters()
Expand Down
7 changes: 4 additions & 3 deletions ros/dynamic_reconfigure/scripts/reconfigure_gui
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
from __future__ import print_function

if __name__ == '__main__':
print '\033[91m' + "reconfigure_gui has moved!\n" + '\033[0m'
print " Try: " + '\033[92m' + "rosrun rqt_reconfigure rqt_reconfigure\n" + '\033[0m'
print " If you see this as part of a tutorial or a script, please update to reflect this change."
print('\033[91m' + "reconfigure_gui has moved!\n" + '\033[0m')
print(" Try: " + '\033[92m' + "rosrun rqt_reconfigure rqt_reconfigure\n" + '\033[0m')
print(" If you see this as part of a tutorial or a script, please update to reflect this change.")
4 changes: 2 additions & 2 deletions ros/dynamic_reconfigure/src/dynamic_reconfigure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# POSSIBILITY OF SUCH DAMAGE.

"""
Python client API for dynamic_reconfigure (L{Client}) as well as
Python client API for dynamic_reconfigure (L{Client}) as well as
example server implementation (L{Server}).
"""

Expand All @@ -56,7 +56,7 @@ class DynamicReconfigureCallbackException(DynamicReconfigureException):

def find_reconfigure_services():
import rosservice
return sorted([s[:-len('/set_parameters')] for s in rosservice.get_service_list() if s.endswith('/set_parameters')])
return sorted([s[:-len('/set_parameters')] for s in rosservice.get_service_list() if s.endswith('/set_parameters')])

def get_parameter_names(descr):
return descr.defaults.keys()
Loading

0 comments on commit 59db996

Please sign in to comment.