@@ -18,6 +18,12 @@ const loader = require('./interface_loader.js');
1818const rclnodejs = require ( 'bindings' ) ( 'rclnodejs' ) ;
1919const Service = require ( './service.js' ) ;
2020
21+ const {
22+ ParameterType,
23+ Parameter,
24+ ParameterDescriptor,
25+ } = require ( '../lib/parameter.js' ) ;
26+
2127// This class is used to create a TypeDescriptionService which can be used to
2228// retrieve information about types used by the node’s publishers, subscribers,
2329// services or actions.
@@ -32,10 +38,30 @@ class TypeDescriptionService {
3238 'type_description_interfaces/srv/GetTypeDescription'
3339 ) ;
3440 this . _typeDescriptionService = null ;
41+
42+ this . _enabled = false ;
43+ const startTypeDescriptionServiceParam = 'start_type_description_service' ;
44+ if ( ! node . hasParameter ( startTypeDescriptionServiceParam ) ) {
45+ node . declareParameter (
46+ new Parameter (
47+ startTypeDescriptionServiceParam ,
48+ ParameterType . PARAMETER_BOOL ,
49+ true
50+ ) ,
51+ new ParameterDescriptor (
52+ startTypeDescriptionServiceParam ,
53+ ParameterType . PARAMETER_BOOL ,
54+ 'If enabled, start the ~/get_type_description service.' ,
55+ true
56+ )
57+ ) ;
58+ }
59+ const param = node . getParameter ( startTypeDescriptionServiceParam ) ;
60+ this . _enabled = param . value ;
3561 }
3662
3763 start ( ) {
38- if ( this . _typeDescriptionService ) {
64+ if ( ! this . _enabled || this . _typeDescriptionService ) {
3965 return ;
4066 }
4167
0 commit comments