Robotics StackExchange | Archived questions

rosserial serial client crash on undefined parameter

I am running fuerte on Ubuntu 12.04, have rosserial installed through apt, and my Arduino code compiling using version 1.0. When I attempt to get a parameter that has not been defined the serial client crashes.

My code running on an Arduino:

float param; while(!nh.connected()) {nh.spinOnce();}
if(!nh.getParam("param", &param)) {param = 1.0;}

Traceback I get in the console when the node crashes:

File "/opt/ros/fuerte/stacks/rosserial/rosserialpython/nodes/serialnode.py", line 58, in client.run() File "/opt/ros/fuerte/stacks/rosserial/rosserialpython/src/rosserialpython/SerialClient.py", line 244, in run self.handleParameterRequest(msg) File "/opt/ros/fuerte/stacks/rosserial/rosserialpython/src/rosserialpython/SerialClient.py", line 274, in handleParameterRequest param = rospy.getparam(req.name) File "/opt/ros/fuerte/lib/python2.7/dist-packages/rospy/client.py", line 403, in getparam return paramserver[paramname] #MasterProxy does all the magic for us File "/opt/ros/fuerte/lib/python2.7/dist-packages/rospy/msproxy.py", line 117, in _getitem__ raise KeyError(key) KeyError: 'param'

Asked by bgoldfai on 2012-06-12 11:35:22 UTC

Comments

Answers