@@ -3331,8 +3331,10 @@ function Param(options) {
3331
3331
*
3332
3332
* @param {function } callback - Function with the following params:
3333
3333
* @param {Object } callback.value - The value of the param from ROS.
3334
+ * @param {function } [failedCallback] - Function when the service call failed with the following params:
3335
+ * @param {string } failedCallback.error - The error message reported by ROS.
3334
3336
*/
3335
- Param . prototype . get = function ( callback ) {
3337
+ Param . prototype . get = function ( callback , failedCallback ) {
3336
3338
var paramClient = new Service ( {
3337
3339
ros : this . ros ,
3338
3340
name : '/rosapi/get_param' ,
@@ -3346,16 +3348,18 @@ Param.prototype.get = function(callback) {
3346
3348
paramClient . callService ( request , function ( result ) {
3347
3349
var value = JSON . parse ( result . value ) ;
3348
3350
callback ( value ) ;
3349
- } ) ;
3351
+ } , failedCallback ) ;
3350
3352
} ;
3351
3353
3352
3354
/**
3353
3355
* Set the value of the param in ROS.
3354
3356
*
3355
3357
* @param {Object } value - The value to set param to.
3356
- * @param {function } callback - The callback function.
3358
+ * @param {function } [callback] - The callback function.
3359
+ * @param {function } [failedCallback] - The callback function when the service call failed.
3360
+ * @param {string } failedCallback.error - The error message reported by ROS.
3357
3361
*/
3358
- Param . prototype . set = function ( value , callback ) {
3362
+ Param . prototype . set = function ( value , callback , failedCallback ) {
3359
3363
var paramClient = new Service ( {
3360
3364
ros : this . ros ,
3361
3365
name : '/rosapi/set_param' ,
@@ -3367,15 +3371,17 @@ Param.prototype.set = function(value, callback) {
3367
3371
value : JSON . stringify ( value )
3368
3372
} ) ;
3369
3373
3370
- paramClient . callService ( request , callback ) ;
3374
+ paramClient . callService ( request , callback , failedCallback ) ;
3371
3375
} ;
3372
3376
3373
3377
/**
3374
3378
* Delete this parameter on the ROS server.
3375
3379
*
3376
- * @param {function } callback - The callback function.
3380
+ * @param {function } [callback] - The callback function when the service call succeeded.
3381
+ * @param {function } [failedCallback] - The callback function when the service call failed.
3382
+ * @param {string } failedCallback.error - The error message reported by ROS.
3377
3383
*/
3378
- Param . prototype . delete = function ( callback ) {
3384
+ Param . prototype . delete = function ( callback , failedCallback ) {
3379
3385
var paramClient = new Service ( {
3380
3386
ros : this . ros ,
3381
3387
name : '/rosapi/delete_param' ,
@@ -3386,7 +3392,7 @@ Param.prototype.delete = function(callback) {
3386
3392
name : this . name
3387
3393
} ) ;
3388
3394
3389
- paramClient . callService ( request , callback ) ;
3395
+ paramClient . callService ( request , callback , failedCallback ) ;
3390
3396
} ;
3391
3397
3392
3398
module . exports = Param ;
0 commit comments