Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2RosCpp
Commits
dc5a74ce
Commit
dc5a74ce
authored
Jan 11, 2019
by
Alexander David Hellwig
Browse files
Add working ROS2 Adapter as result for testcase
parent
0e0436f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/test/resources/results/echoCMakeRos2/CMakeLists.txt
View file @
dc5a74ce
cmake_minimum_required
(
VERSION 3.5
)
project
(
RosAdapter_tests_a_compA
)
find_package
(
automated_driving_msgs REQUIRED
)
find_package
(
rclcpp REQUIRED
)
find_package
(
rosgraph
_msgs REQUIRED
)
find_package
(
std
_msgs REQUIRED
)
add_library
(
RosAdapter_tests_a_compA RosAdapter_tests_a_compA.
h
)
add_library
(
RosAdapter_tests_a_compA RosAdapter_tests_a_compA.
cxx
)
set_target_properties
(
RosAdapter_tests_a_compA PROPERTIES LINKER_LANGUAGE CXX
)
target_link_libraries
(
RosAdapter_tests_a_compA tests_a_compA
${
automated_driving_msgs_LIBRARIES
}
${
rclcpp_LIBRARIES
}
${
rosgraph
_msgs_LIBRARIES
}
)
target_include_directories
(
RosAdapter_tests_a_compA PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
${
automated_driving
_msgs_INCLUDE_DIRS
}
${
rclcpp_INCLUDE_DIRS
}
${
rosgraph_msgs_INCLUDE_DIRS
}
)
target_link_libraries
(
RosAdapter_tests_a_compA tests_a_compA
${
rclcpp_LIBRARIES
}
${
std
_msgs_LIBRARIES
}
IAdapter_tests_a_compA
)
target_include_directories
(
RosAdapter_tests_a_compA PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
${
std
_msgs_INCLUDE_DIRS
}
${
rclcpp_INCLUDE_DIRS
}
)
export
(
TARGETS RosAdapter_tests_a_compA FILE RosAdapter_tests_a_compA.cmake
)
\ No newline at end of file
src/test/resources/results/echoCMakeRos2/RosAdapter_tests_a_compA.cxx
0 → 100644
View file @
dc5a74ce
#include "RosAdapter_tests_a_compA.h"
\ No newline at end of file
src/test/resources/results/echoCMakeRos2/RosAdapter_tests_a_compA.h
View file @
dc5a74ce
#pragma once
#include "IAdapter_tests_a_compA.hpp"
#include "tests_a_compA.hpp"
#include <automated_driving_msgs/StampedFloat64.hpp>
#include <rclpp/rclpp.hpp>
#include <rosgraph_msgs/Clock.hpp>
#include "IAdapter_tests_a_compA.h"
#include "tests_a_compA.h"
#include <std_msgs/msg/float64.hpp>
#include "rclcpp/rclcpp.hpp"
class
RosAdapter_tests_a_compA
:
public
IAdapter_tests_a_compA
{
tests_a_compA
*
component
;
rclpp
::
Subscri
be
r
_clockSubscriber
;
rclpp
::
Publisher
_echoPublisher
;
rcl
c
pp
::
Subscri
ption
<
std_msgs
::
msg
::
Float64
>::
SharedPt
r
_clockSubscriber
;
rcl
c
pp
::
Publisher
<
std_msgs
::
msg
::
Float64
>::
SharedPtr
_echoPublisher
;
public:
RosAdapter_tests_a_compA
(){
}
void
_clockCallback
(
const
rosgraph_msgs
::
Clock
::
SharedPtr
msg
){
component
->
rosIn
=
msg
->
clock
.
toSec
()
;
void
_clockCallback
(
const
std_msgs
::
msg
::
Float64
::
SharedPtr
msg
){
component
->
rosIn
=
msg
->
data
;
}
void
init
(
tests_a_compA
*
comp
){
this
->
component
=
comp
;
char
*
tmp
=
strdup
(
""
);
int
i
=
0
;
int
i
=
1
;
rclcpp
::
init
(
i
,
&
tmp
);
_clockSubscriber
=
node_handle
->
create_subscription
<
rosgraph_msgs
::
Clock
>
(
"/clock"
,
_clockCallback
);
_echoPublisher
=
node_handle
->
create_publisher
<
automated_driving_msgs
::
StampedFloat64
>
(
"/echo"
);
rclcpp
::
spin
(
RosAdapter_tests_a_compA
);
auto
node_handle
=
rclcpp
::
Node
::
make_shared
(
"RosAdapter_tests_a_compA"
);
_clockSubscriber
=
node_handle
->
create_subscription
<
std_msgs
::
msg
::
Float64
>
(
"/clock"
,
std
::
bind
(
&
RosAdapter_tests_a_compA
::
_clockCallback
,
this
,
std
::
placeholders
::
_1
));
_echoPublisher
=
node_handle
->
create_publisher
<
std_msgs
::
msg
::
Float64
>
(
"/echo"
);
rclcpp
::
spin
(
node_handle
);
}
void
publish_echoPublisher
(){
automated_driving_msgs
::
Stamped
Float64
tmpMsg
;
std_msgs
::
msg
::
Float64
tmpMsg
;
tmpMsg
.
data
=
component
->
rosOut
;
_echoPublisher
.
publish
(
tmpMsg
);
_echoPublisher
->
publish
(
tmpMsg
);
}
void
tick
(){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment