Skip to content

Latest commit

 

History

History
52 lines (42 loc) · 1.6 KB

HowToUseLongParameters.md

File metadata and controls

52 lines (42 loc) · 1.6 KB

How to use long parameters

Description: This tutorial will tell you how to use long parameters (which are not supported by the parameter server).

Tutorial Level: EASY

Problem

xmlrpclib.py as used by roslaunch does not support type long (64 bit integers, i.e. in (-2**63,2**63-1) but outside (-2**31,2**31-1)):

<arg name="long_param" value="12345678910111213" />

results in an error.

Background

see

Workaround

We use the following workaround:

  • Add the substring L to the long parameter, making it a string (in case it is outside the valid integer range), e.g.
gen.add("long_param", paramtype="int64_t", description="A long parameter", default="12345678910111213L")
# or
gen.add("long_param", paramtype="int64_t", description="A long parameter", default="1L")
# or
gen.add("long_param", paramtype="int64_t", description="A long parameter", default=1)
  • when setting it via an launchfile argument:
<arg name="long_param" value="12345678910111213L" />
<!-- or -->
<arg name="long_param" value="1L" />
<!-- or -->
<arg name="long_param" value="1" />
  • when setting it via a yaml:
long_param: "12345678910111213L"
# or
long_param: "1L"
# or
long_param: 1
  • For long parameters, a string is automatically cast to a 64bit integer when reading from the parameter server
  • Any long parameter is stored as string when writing to the parameter server