Ask Your Question
0

Handling Date/Time parameters issues in rosparam/paramserver?

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

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>
    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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

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:

https://code.ros.org/trac/ros/ticket/3588

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 434 times

Last updated: Sep 02 '11