Compare commits

...

6 Commits

Author SHA1 Message Date
winterhalderp c1d9c6e33c Minor Changes to comments 2021-06-05 18:09:59 +02:00
winterhalderp 25b8997abe Comment Changes in pubsub_library_v3 2021-05-26 12:03:58 +02:00
winterhalderp 19ff69e8a4 another test 2 2021-05-24 16:42:41 +02:00
winterhalderp 57be3d0d8e another test 2021-05-24 16:40:45 +02:00
patrickw135 3d1c97d514 test for errors 2021-05-24 16:38:46 +02:00
patrickw135 b29be30aa3 Delete custom_interfaces & pubsub_msg pkgs 2021-05-24 16:26:21 +02:00
13 changed files with 7 additions and 279 deletions

View File

@ -1,64 +0,0 @@
cmake_minimum_required(VERSION 3.5)
project(custom_interfaces)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(std_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
# -->
# ADD THESE LINES: START HERE
find_package(rosidl_default_generators REQUIRED)
find_package(rclcpp REQUIRED)
# CUSTOM LINES: CHANGE FOR YOUR FILENAMES
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/CustomMsg1.msg"
"msg/CustomMsg2.msg"
"srv/CustomSrv1.srv"
"srv/StateMachineSrv.srv"
DEPENDENCIES builtin_interfaces
)
# END HERE
# <--
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()

View File

@ -1,40 +0,0 @@
Use this ROS2 package to create custom interfaces, eg. topic (*.msg) and/or service (*.srv) files.
This package must only be used for interface files and __no__ Python scripts.
The following steps describe how to create a new custom topic or service.
## 1. Create new interface file
Topic *.msg files got into `msg` directory,
Service *.srv files got into `srv` directory.
Create these files according to the example on this [instructions page](https://docs.ros.org/en/foxy/Tutorials/Writing-A-Simple-Py-Service-And-Client.html).
## 2. CMakeLists.txt
Edit the `CMakeLists.txt` file by adding the newly created *.msg or *.srv files to this part:
```cmake
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/CustomMsg1.msg"
"msg/CustomMsg2.msg"
"srv/CustomSrv1.srv"
DEPENDENCIES builtin_interfaces
)
```
## 3. Build colcon workspace
Move back to the root of your _colcon_ workspace and rebuild it: `colcon build --symlink-install`
It should build without any errors. If you encounter errors fix these before continuing.
After a successful build you must __close and reopen all terminals__ in order to source the newly built workspace. For this to happen you must have edited _.bashrc_ and added your current workspace (`sudo nano ~/.bashrc` and follow [this example](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/non-ros-files/bashrc_overlay.bash)).
## 4. Import interfaces
Import the newly created interfaces into the Python scripts. These scripts must be located in _Python packages_ inside the same workspace (or another _sourced_ workspace):
* Topics:
```python
from custom_interfaces.msg import CustomMsg1
```
* Services:
```python
from custom_interfaces.srv import CustomSrv1
```
Now you can work with your custom interface in order to exchange custom information between nodes.

View File

@ -1,8 +0,0 @@
# Header data, eg timestamp
# Problem: "header__struct.hpp: No such file or directory"
#Header header
# Sensor Data coming back from an array of atmospheric sensors
float32[] temperature
float32[] pressure
float32[] humidity

View File

@ -1,7 +0,0 @@
# Header data, eg timestamp
# Problem: "header__struct.hpp: No such file or directory"
#Header header
# User inputs, eg. for controlling a camera mast , eg. set angles [rad]
float32 pitch_ctrl
float32 yaw_ctrl

View File

@ -1,42 +0,0 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>custom_interfaces</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="rosmobile@todo.todo">rosmobile</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<!-- ADD THESE LINES: START HERE -->
<build_depend>builtin_interfaces</build_depend>
<build_depend>rosidl_default_generators</build_depend>
<exec_depend>builtin_interfaces</exec_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<!-- END HERE -->
<depend>std_msgs</depend>
<!-- DO NOT ENTER THIS DEPENDENCY WHEN CREATING NEW PACKAGE -->
<!-- <depend>builtin_interfaces</depend> -->
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

View File

@ -1,3 +0,0 @@
string command
---
bool success

View File

@ -1,4 +0,0 @@
string command
float32 value
---
bool success

View File

@ -15,7 +15,9 @@
<!-- CUSTOM LINE -->
<!-- This is custom for the package you depend on -->
<exec_depend>pubsub_msg</exec_depend>
<!-- <exec_depend>pubsub_msg</exec_depend> -->
<exec_depend>custom_interfaces</exec_depend>
<!-- test -->
<!-- END HERE -->

View File

@ -166,7 +166,9 @@ class MinimalServiceProvider(Node):
# Insert your callback code here
def user_defined(self, request, response):
""" Write your user defined code here which will be run at every service call
""" OLD! Use function parameter srv_callback_fct instead!
Write your user defined code here which will be run at every service call
Input:
* request: srv request class
@ -201,7 +203,7 @@ class MinimalServiceClientAsync(Node):
def send_request(self, request):
"""
Feed request of type "SRV_TYPE.Request()"
Access variable using
Access individual variables using
* request = SRV_TYPE.Request()
* request.<var_name> = ....
"""

View File

@ -1,59 +0,0 @@
cmake_minimum_required(VERSION 3.5)
project(pubsub_msg)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
# -->
# ADD THESE LINES: START HERE
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rclcpp REQUIRED)
# CUSTOM LINES: CHANGE FOR YOUR FILENAMES
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/CustomMsg1.msg"
"msg/CustomMsg2.msg"
DEPENDENCIES builtin_interfaces
)
# END HERE
# <--
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()

View File

@ -1,8 +0,0 @@
# Header data, eg timestamp
# Problem: "header__struct.hpp: No such file or directory"
#Header header
# Sensor Data coming back from an array of atmospheric sensors
float32[] temperature
float32[] pressure
float32[] humidity

View File

@ -1,7 +0,0 @@
# Header data, eg timestamp
# Problem: "header__struct.hpp: No such file or directory"
#Header header
# User inputs, eg. for controlling a camera mast , eg. set angles [rad]
float32 pitch_ctrl
float32 yaw_ctrl

View File

@ -1,34 +0,0 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>pubsub_msg</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="winterhalder.p@googlemail.com">patrick</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<!-- ADD THESE LINES: START HERE -->
<build_depend>builtin_interfaces</build_depend>
<build_depend>rosidl_default_generators</build_depend>
<exec_depend>builtin_interfaces</exec_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<!-- END HERE -->
<export>
<build_type>ament_cmake</build_type>
</export>
</package>