Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 16

Handling Date/Time parameters issues in rosparam/paramserver?

$
0
0
I'm wondering how to correctly set/get date/time parameters in the parameter server or if there is possibly a bug. On a freshly started roscore I do: rosparam set /date1 2011-07-11T18:04:00 Now I get the parameter as an XmlRpcValue and have the following code (where val is the XmlRpcValue): case XmlRpc::XmlRpcValue::TypeDateTime: { struct tm time = (struct tm)val; printf("YEAR is %d\n", time.tm_year); The printout displays 2011. Accoring to the specs I have read, this should be the years since 1900, so I expected 111. Did I make a mistake when setting the date/time or is this a bug? Also (maybe related), when I do: rosparam get /date1 I get:
Traceback (most recent call last):
  File "/opt/ros/diamondback/ros/bin/rosparam", line 40, in 
    rosparam.yamlmain()
  File "/opt/ros/diamondback/stacks/ros_comm/tools/rosparam/src/rosparam.py", line 633, in yamlmain
    _rosparam_cmd_get_dump(command, argv)
  File "/opt/ros/diamondback/stacks/ros_comm/tools/rosparam/src/rosparam.py", line 454, in _rosparam_cmd_get_dump
    _rosparam_cmd_get_param(script_resolve_name(NAME, arg), pretty=options.pretty, verbose=options.verbose)
  File "/opt/ros/diamondback/stacks/ros_comm/tools/rosparam/src/rosparam.py", line 283, in _rosparam_cmd_get_param
    dump = yaml.dump(val)
  File "/usr/lib/python2.6/dist-packages/yaml/__init__.py", line 175, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
  File "/usr/lib/python2.6/dist-packages/yaml/__init__.py", line 165, in dump_all
    dumper.represent(data)
  File "/usr/lib/python2.6/dist-packages/yaml/representer.py", line 33, in represent
    node = self.represent_data(data)
  File "/usr/lib/python2.6/dist-packages/yaml/representer.py", line 46, in represent_data
    if self.ignore_aliases(data):
  File "/usr/lib/python2.6/dist-packages/yaml/representer.py", line 147, in ignore_aliases
    if data in [None, ()]:
  File "/usr/lib/python2.6/xmlrpclib.py", line 419, in __eq__
    s, o = self.make_comparable(other)
  File "/usr/lib/python2.6/xmlrpclib.py", line 399, in make_comparable
    (self.__class__.__name__, otype))
TypeError: Can't compare DateTime and NoneType
Lives now as a [ticket](https://code.ros.org/trac/ros/ticket/3588).

Viewing all articles
Browse latest Browse all 16

Latest Images

Trending Articles





Latest Images