Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_nav_module
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labrobotica
ros
navigation
iri_nav_module
Commits
5eaa2246
Commit
5eaa2246
authored
2 years ago
by
Fernando Herrero
Browse files
Options
Downloads
Patches
Plain Diff
Add diagnostic: module state
parent
5bd23b65
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/iri_nav_module/nav_module.h
+51
-2
51 additions, 2 deletions
include/iri_nav_module/nav_module.h
with
51 additions
and
2 deletions
include/iri_nav_module/nav_module.h
+
51
−
2
View file @
5eaa2246
...
...
@@ -22,6 +22,8 @@
#include
<iri_nav_module/nav_costmap_module.h>
#include
<diagnostic_updater/diagnostic_updater.h>
/**
* \brief Navigation module
*
...
...
@@ -205,17 +207,42 @@ class CNavModule : public CModule<ModuleCfg>
* \brief
*
*/
virtual
void
state_machine
(
void
)
=
0
;
virtual
void
state_machine
(
void
){
// update diagnostics
this
->
diagnostic_updater_
.
update
();
ros
::
WallDuration
(
1.0
).
sleep
();
//TODO: use cfg param with update rate
};
/**
* \brief
*
*/
virtual
void
reconfigure_callback
(
ModuleCfg
&
config
,
uint32_t
level
)
=
0
;
/**
* \brief
*
*/
void
module_running_state
(
diagnostic_updater
::
DiagnosticStatusWrapper
&
stat
);
/**
* \brief
*
*/
diagnostic_updater
::
FunctionDiagnosticTask
module_running_state_diagnostic
;
/**
* \brief
*
*/
bool
transform_goal
(
double
&
x
,
double
&
y
,
double
&
yaw
);
/**
* \brief diagnostic updater
*
* The diagnostic updater allows definition of custom diagnostics.
*
*/
diagnostic_updater
::
Updater
diagnostic_updater_
;
public
:
/**
...
...
@@ -223,6 +250,7 @@ class CNavModule : public CModule<ModuleCfg>
*
*/
CNavModule
(
const
std
::
string
&
name
,
const
std
::
string
&
name_space
=
std
::
string
(
""
));
/**
* \brief
*
...
...
@@ -413,6 +441,13 @@ class CNavModule : public CModule<ModuleCfg>
*
*/
const
CNavCostmapModule
<
ModuleCfg
>
&
get_global_costmap
(
void
)
const
;
/**
* \brief
*
*/
void
check_module_running_state
(
diagnostic_updater
::
DiagnosticStatusWrapper
&
stat
);
/**
* \brief Destructor
*
...
...
@@ -423,12 +458,14 @@ class CNavModule : public CModule<ModuleCfg>
template
<
class
ModuleCfg
>
CNavModule
<
ModuleCfg
>::
CNavModule
(
const
std
::
string
&
name
,
const
std
::
string
&
name_space
)
:
CModule
<
ModuleCfg
>
(
name
,
name_space
),
tf2_listener
(
tf2_buffer
),
diagnostic_updater_
(),
move_base_action
(
"move_base"
,
this
->
module_nh
.
getNamespace
()),
move_base_reconf
(
"move_base_reconf"
,
this
->
module_nh
.
getNamespace
()),
make_plan_service
(
"make_plan"
,
this
->
module_nh
.
getNamespace
()),
clear_costmaps
(
"clear_costmaps"
,
this
->
module_nh
.
getNamespace
()),
local_costmap
(
"local_costmap"
,
this
->
module_nh
.
getNamespace
()),
global_costmap
(
"global_costmap"
,
this
->
module_nh
.
getNamespace
())
global_costmap
(
"global_costmap"
,
this
->
module_nh
.
getNamespace
()),
module_running_state_diagnostic
(
this
->
module_nh
.
getNamespace
()
+
"/module_running_state"
,
boost
::
bind
(
&
CNavModule
<
ModuleCfg
>::
check_module_running_state
,
this
,
_1
))
{
//Variables
this
->
path_available
=
false
;
...
...
@@ -451,6 +488,9 @@ class CNavModule : public CModule<ModuleCfg>
this
->
robot_frame_id
=
"base_link"
;
this
->
global_frame_id
=
"map"
;
this
->
goal_frame_id
=
"map"
;
//diagnostic_updater::FunctionDiagnosticTask module_running_state_diagnostic("module_running_state",boost::bind(&CNavModule<ModuleCfg>::check_module_running_state, this));
this
->
diagnostic_updater_
.
add
(
this
->
module_running_state_diagnostic
);
}
template
<
class
ModuleCfg
>
...
...
@@ -1070,6 +1110,15 @@ class CNavModule : public CModule<ModuleCfg>
{
return
this
->
global_costmap
;
}
template
<
class
ModuleCfg
>
void
CNavModule
<
ModuleCfg
>::
check_module_running_state
(
diagnostic_updater
::
DiagnosticStatusWrapper
&
stat
)
{
if
(
this
->
move_base_action
.
get_state
()
==
ACTION_RUNNING
)
stat
.
summary
(
diagnostic_msgs
::
DiagnosticStatus
::
OK
,
"running"
);
else
stat
.
summary
(
diagnostic_msgs
::
DiagnosticStatus
::
OK
,
"not running"
);
}
template
<
class
ModuleCfg
>
CNavModule
<
ModuleCfg
>::~
CNavModule
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment