Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_ros_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
iri_core
iri_ros_scripts
Commits
296b948f
Commit
296b948f
authored
5 years ago
by
Fernando Herrero
Browse files
Options
Downloads
Patches
Plain Diff
Add updates also to driver
parent
52b0a5d0
No related branches found
No related tags found
1 merge request
!4
Updates
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
create_driver_package.sh
+18
-13
18 additions, 13 deletions
create_driver_package.sh
driver_templates/template_driver.cfg
+2
-2
2 additions, 2 deletions
driver_templates/template_driver.cfg
driver_templates/template_driver_node.cpp
+11
-1
11 additions, 1 deletion
driver_templates/template_driver_node.cpp
with
31 additions
and
16 deletions
create_driver_package.sh
+
18
−
13
View file @
296b948f
...
...
@@ -176,20 +176,25 @@ sed -e "s/template_driver/${driver_filename}/g" \
eval
"chmod 775
${
project_name
}
/cfg/
${
basename
}
.cfg"
echo
"Creating
${
basename
}
.cfg file..."
echo
""
################################################################################
#create launch/config directory
mkdir
-p
${
project_name
}
/launch/
sed
-e
"s/template/
${
project_name
}
/g"
<
${
IRI_ROS_SCRIPTS_PATH
}
/common_templates/node.launch
>
"
${
project_name
}
/launch/node.launch"
sed
-e
"s/template/
${
project_name
}
/g"
<
${
IRI_ROS_SCRIPTS_PATH
}
/common_templates/test.launch
>
"
${
project_name
}
/launch/test.launch"
mkdir
-p
${
project_name
}
/config/
cp
${
IRI_ROS_SCRIPTS_PATH
}
/common_templates/params.yaml
${
project_name
}
/config/params.yaml
################################################################################
################################################################################
#add license and readme
cp
${
IRI_ROS_SCRIPTS_PATH
}
/common_templates/LICENSE
${
project_name
}
/LICENSE
sed
-e
"s/template/
${
project_name
}
/g"
<
${
IRI_ROS_SCRIPTS_PATH
}
/common_templates/README.md
>
"
${
project_name
}
/README.md"
################################################################################
+#create launch directory
+mkdir
-p
${
project_name
}
/launch/
-echo
""
+sed
-e
"s/template/
${
project_name
}
/g"
<
${
temps_folder
}
/node.launch
>
"
${
project_name
}
/launch/node.launch"
+sed
-e
"s/template/
${
project_name
}
/g"
<
${
temps_folder
}
/test.launch
>
"
${
project_name
}
/launch/test.launch"
+################################################################################
+#add license and readme
+cp
${
IRI_ROS_SCRIPTS_PATH
}
/common_templates/LICENSE
${
project_name
}
/LICENSE
+
+sed
-e
"s/template/
${
project_name
}
/g"
<
${
temps_folder
}
/README.md
>
"
${
project_name
}
/README.md"
+
+################################################################################
echo
""
echo
"Project
${
project_name
}
has been successfully created!!"
...
...
This diff is collapsed.
Click to expand it.
driver_templates/template_driver.cfg
+
2
−
2
View file @
296b948f
...
...
@@ -38,7 +38,7 @@ from dynamic_reconfigure.parameter_generator_catkin import *
gen
= ParameterGenerator()
# Name
Type Reconfiguration level
Description
Default
Min Max
#
gen.add("
velocity_scale_factor",
double_t, SensorLevels.RECONFIGURE_STOP, "Maximum velocity scale factor
", 0.
5, 0.0, 1
.0)
# Name
Type Reconf.level
Description Default Min Max
gen.add("
rate",
double_t, 0, "Main loop rate (Hz)
",
1
0.
0, 0.1, 1000
.0)
exit(gen.generate(PACKAGE,
"TemplateDriver", "Template"))
This diff is collapsed.
Click to expand it.
driver_templates/template_driver_node.cpp
+
11
−
1
View file @
296b948f
...
...
@@ -4,7 +4,12 @@ TemplateNode::TemplateNode(ros::NodeHandle &nh) :
iri_base_driver
::
IriBaseNodeDriver
<
TemplateDriver
>
(
nh
)
{
//init class attributes if necessary
//this->setRate(10);//in [Hz]
if
(
!
this
->
private_node_handle_
.
getParam
(
"rate"
,
this
->
config_
.
rate
))
{
ROS_WARN
(
"TemplateNode::TemplateNode: param 'rate' not found"
);
}
else
this
->
setRate
(
this
->
config_
.
rate
);
// [init publishers]
...
...
@@ -23,6 +28,7 @@ void TemplateNode::mainNodeThread(void)
{
//lock access to driver if necessary
this
->
driver_
.
lock
();
ROS_INFO
(
"TemplateNode::mainNodeThread"
);
// [fill msg Header if necessary]
...
...
@@ -60,6 +66,10 @@ void TemplateNode::addNodeDiagnostics(void)
void
TemplateNode
::
node_config_update
(
Config
&
new_cfg
,
uint32_t
level
)
{
this
->
driver_
.
lock
();
if
(
new_cfg
.
rate
!=
this
->
getRate
())
this
->
setRate
(
new_cfg
.
rate
);
this
->
driver_
.
unlock
();
}
TemplateNode
::~
TemplateNode
(
void
)
...
...
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