Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rosaria
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
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
platforms
Pioneer3
rosaria
Commits
1f9ef1a7
Commit
1f9ef1a7
authored
5 years ago
by
Fernando Herrero
Browse files
Options
Downloads
Patches
Plain Diff
Add encoder data publish
parent
204dc0c6
Branches
master
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
RosAria.cpp
+16
-0
16 additions, 0 deletions
RosAria.cpp
msg/Encoders.msg
+3
-0
3 additions, 0 deletions
msg/Encoders.msg
with
20 additions
and
0 deletions
CMakeLists.txt
+
1
−
0
View file @
1f9ef1a7
...
@@ -23,6 +23,7 @@ find_package(catkin REQUIRED COMPONENTS message_generation roscpp nav_msgs geome
...
@@ -23,6 +23,7 @@ find_package(catkin REQUIRED COMPONENTS message_generation roscpp nav_msgs geome
add_message_files
(
add_message_files
(
FILES
FILES
BumperState.msg
BumperState.msg
Encoders.msg
)
)
#uncomment if you have defined services
#uncomment if you have defined services
#add_service_files(
#add_service_files(
...
...
This diff is collapsed.
Click to expand it.
RosAria.cpp
+
16
−
0
View file @
1f9ef1a7
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include
"tf/transform_datatypes.h"
#include
"tf/transform_datatypes.h"
#include
<dynamic_reconfigure/server.h>
#include
<dynamic_reconfigure/server.h>
#include
<rosaria/RosAriaConfig.h>
#include
<rosaria/RosAriaConfig.h>
#include
"rosaria/Encoders.h"
#include
"std_msgs/Float64.h"
#include
"std_msgs/Float64.h"
#include
"std_msgs/Float32.h"
#include
"std_msgs/Float32.h"
#include
"std_msgs/Int8.h"
#include
"std_msgs/Int8.h"
...
@@ -133,6 +134,9 @@ class RosAriaNode
...
@@ -133,6 +134,9 @@ class RosAriaNode
// whether to publish aria lasers
// whether to publish aria lasers
bool
publish_aria_lasers
;
bool
publish_aria_lasers
;
ros
::
Publisher
encoder_pub
;
rosaria
::
Encoders
encoders
;
};
};
void
RosAriaNode
::
readParameters
()
void
RosAriaNode
::
readParameters
()
...
@@ -337,11 +341,15 @@ RosAriaNode::RosAriaNode(ros::NodeHandle nh) :
...
@@ -337,11 +341,15 @@ RosAriaNode::RosAriaNode(ros::NodeHandle nh) :
disable_srv
=
n
.
advertiseService
(
"disable_motors"
,
&
RosAriaNode
::
disable_motors_cb
,
this
);
disable_srv
=
n
.
advertiseService
(
"disable_motors"
,
&
RosAriaNode
::
disable_motors_cb
,
this
);
veltime
=
ros
::
Time
::
now
();
veltime
=
ros
::
Time
::
now
();
encoder_pub
=
n
.
advertise
<
rosaria
::
Encoders
>
(
"encoders"
,
1
);
}
}
RosAriaNode
::~
RosAriaNode
()
RosAriaNode
::~
RosAriaNode
()
{
{
// disable motors and sonar.
// disable motors and sonar.
robot
->
stopEncoderPackets
();
robot
->
disableMotors
();
robot
->
disableMotors
();
robot
->
disableSonar
();
robot
->
disableSonar
();
...
@@ -520,6 +528,8 @@ int RosAriaNode::Setup()
...
@@ -520,6 +528,8 @@ int RosAriaNode::Setup()
if
(
cmdvel_timeout_param
>
0.0
)
if
(
cmdvel_timeout_param
>
0.0
)
cmdvel_watchdog_timer
=
n
.
createTimer
(
ros
::
Duration
(
0.1
),
&
RosAriaNode
::
cmdvel_watchdog
,
this
);
cmdvel_watchdog_timer
=
n
.
createTimer
(
ros
::
Duration
(
0.1
),
&
RosAriaNode
::
cmdvel_watchdog
,
this
);
robot
->
requestEncoderPackets
();
ROS_INFO_NAMED
(
"rosaria"
,
"rosaria: Setup complete"
);
ROS_INFO_NAMED
(
"rosaria"
,
"rosaria: Setup complete"
);
return
0
;
return
0
;
}
}
...
@@ -690,6 +700,12 @@ void RosAriaNode::publish()
...
@@ -690,6 +700,12 @@ void RosAriaNode::publish()
sonar_pub
.
publish
(
cloud
);
sonar_pub
.
publish
(
cloud
);
}
}
}
// end if sonar_enabled
}
// end if sonar_enabled
// send the encoder information
encoders
.
left_encoder
=
robot
->
getLeftEncoder
();
encoders
.
right_encoder
=
robot
->
getRightEncoder
();
encoders
.
header
.
stamp
=
ros
::
Time
::
now
();
encoders
.
header
.
frame_id
=
frame_id_odom
;
encoder_pub
.
publish
(
encoders
);
}
}
bool
RosAriaNode
::
enable_motors_cb
(
std_srvs
::
Empty
::
Request
&
request
,
std_srvs
::
Empty
::
Response
&
response
)
bool
RosAriaNode
::
enable_motors_cb
(
std_srvs
::
Empty
::
Request
&
request
,
std_srvs
::
Empty
::
Response
&
response
)
...
...
This diff is collapsed.
Click to expand it.
msg/Encoders.msg
0 → 100644
+
3
−
0
View file @
1f9ef1a7
Header header
int64 left_encoder
int64 right_encoder
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