Josh,

the test fails

verbeek@rec-laptop3:~$ rosrun test_roscpp param
parameter_validation  params                param_update_test
verbeek@rec-laptop3:~$ rosrun test_roscpp params
[==========] Running 17 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 17 tests from Params
[ RUN      ] Params.allParamTypes
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:53: Failure
Value of: param::get( "string", string_param )
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:54: Failure
Value of: string_param == "test"
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:57: Failure
Value of: param::get( "int", int_param )
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:58: Failure
Value of: int_param == 10
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:61: Failure
Value of: param::get( "double", double_param )
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:62: Failure
Value of: 10.5
Expected: double_param
Which is: 0
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:65: Failure
Value of: param::get( "bool", bool_param )
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:66: Failure
Value of: bool_param
  Actual: true
Expected: false
[  FAILED  ] Params.allParamTypes
[ RUN      ] Params.setThenGetString
[ERROR] [1288337135.593725579]: [setParam] Failed to contact master at [192.168.1.15:11311].  Retrying...
^C
verbeek@rec-laptop3:~$ rosrun test_roscpp params
[==========] Running 17 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 17 tests from Params
[ RUN      ] Params.allParamTypes
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:53: Failure
Value of: param::get( "string", string_param )
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:54: Failure
Value of: string_param == "test"
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:57: Failure
Value of: param::get( "int", int_param )
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:58: Failure
Value of: int_param == 10
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:61: Failure
Value of: param::get( "double", double_param )
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:62: Failure
Value of: 10.5
Expected: double_param
Which is: 0
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:65: Failure
Value of: param::get( "bool", bool_param )
  Actual: false
Expected: true
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:66: Failure
Value of: bool_param
  Actual: true
Expected: false
[  FAILED  ] Params.allParamTypes
[ RUN      ] Params.setThenGetString
[       OK ] Params.setThenGetString
[ RUN      ] Params.setThenGetStringCached
[       OK ] Params.setThenGetStringCached
[ RUN      ] Params.setThenGetStringCachedNodeHandle
[       OK ] Params.setThenGetStringCachedNodeHandle
[ RUN      ] Params.setThenGetCString
[       OK ] Params.setThenGetCString
[ RUN      ] Params.setThenGetInt
[       OK ] Params.setThenGetInt
[ RUN      ] Params.unknownParam
[       OK ] Params.unknownParam
[ RUN      ] Params.deleteParam
[       OK ] Params.deleteParam
[ RUN      ] Params.hasParam
/tmp/buildd/ros-cturtle-ros-1.2.4/debian/ros-cturtle-ros/opt/ros/cturtle/ros/test/test_roscpp/src/params.cpp:132: Failure
Value of: param::has( "string" )
  Actual: false
Expected: true
[  FAILED  ] Params.hasParam
[ RUN      ] Params.setIntDoubleGetInt
[       OK ] Params.setIntDoubleGetInt
[ RUN      ] Params.getIntAsDouble
[       OK ] Params.getIntAsDouble
[ RUN      ] Params.getDoubleAsInt
[       OK ] Params.getDoubleAsInt
[ RUN      ] Params.searchParam
[       OK ] Params.searchParam
[ RUN      ] Params.searchParamNodeHandle
[       OK ] Params.searchParamNodeHandle
[ RUN      ] Params.searchParamNodeHandleWithRemapping
[       OK ] Params.searchParamNodeHandleWithRemapping
[ RUN      ] Params.getMissingXmlRpcValueParameterCachedTwice
[       OK ] Params.getMissingXmlRpcValueParameterCachedTwice
[ RUN      ] Params.doublePrecision
[       OK ] Params.doublePrecision
[----------] Global test environment tear-down
[==========] 17 tests from 1 test case ran.
[  PASSED  ] 15 tests.
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] Params.allParamTypes
[  FAILED  ] Params.hasParam

 2 FAILED TESTS
Do you have a small test-case that fails that I could try?  We have a test-case for exactly this:

  double double_param = 0.0;
  EXPECT_TRUE( param::get( "double", double_param ) );
  EXPECT_DOUBLE_EQ( double_param, 10.5 );

Does the params test in test_roscpp also fail?

Josh

On Thu, Oct 28, 2010 at 5:09 AM, Christian Verbeek <verbeek@servicerobotics.eu> wrote:
getParam(const std::string &key, double &d)

returns only the integer part of the parameter.

ros::NodeHandle nh( "~" );
double dvalue;
nh.getParam( "key", dvalue );

dvalue=0 // in the launch file 0.2
dvalue=1 // in the launch file 1.5
...

in /opt/ros/cturtle/ros/core/roscpp/src/libros/param.cpp
I printed the XmlRpcValue and this gives me

<value><double>0</double></value>
<value><double>1</double></value>

Whats going wrong? Any ideas?

rosparam get key
returns 0.200000000000000001 or 1.5

so the values in the parameter server are correct.

_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users

_______________________________________________ ros-users mailing list ros-users@code.ros.org https://code.ros.org/mailman/listinfo/ros-users