ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Handling Date/Time parameters issues in rosparam/paramserver?

asked 2011-07-11 04:18:00 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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 <module>
  File "/opt/ros/diamondback/stacks/ros_comm/tools/rosparam/src/", line 633, in yamlmain
    _rosparam_cmd_get_dump(command, argv)
  File "/opt/ros/diamondback/stacks/ros_comm/tools/rosparam/src/", 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/", line 283, in _rosparam_cmd_get_param
    dump = yaml.dump(val)
  File "/usr/lib/python2.6/dist-packages/yaml/", line 175, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
  File "/usr/lib/python2.6/dist-packages/yaml/", line 165, in dump_all
  File "/usr/lib/python2.6/dist-packages/yaml/", line 33, in represent
    node = self.represent_data(data)
  File "/usr/lib/python2.6/dist-packages/yaml/", line 46, in represent_data
    if self.ignore_aliases(data):
  File "/usr/lib/python2.6/dist-packages/yaml/", line 147, in ignore_aliases
    if data in [None, ()]:
  File "/usr/lib/python2.6/", line 419, in __eq__
    s, o = self.make_comparable(other)
  File "/usr/lib/python2.6/", line 399, in make_comparable
    (self.__class__.__name__, otype))
TypeError: Can't compare DateTime and NoneType

Lives now as a ticket.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-09-02 10:20:51 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

The ticket appears to be the resolution here, so marking this as the answer:

edit flag offensive delete link more

Question Tools


Asked: 2011-07-11 04:18:00 -0600

Seen: 623 times

Last updated: Sep 02 '11