Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
c1d9c6e33c | |||
25b8997abe | |||
19ff69e8a4 | |||
57be3d0d8e | |||
|
3d1c97d514 | ||
|
b29be30aa3 |
@ -4,43 +4,22 @@
|
||||
# Only the password was changed after first boot
|
||||
# Everything else is stock
|
||||
|
||||
## Reference / Source:
|
||||
# https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html
|
||||
|
||||
## First Update
|
||||
# First Update
|
||||
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y
|
||||
|
||||
### Install ROS2 Foxy Fitzroy for Raspberry Pi
|
||||
|
||||
## Check for UTF-8
|
||||
locale # check for UTF-8
|
||||
sudo apt install locales
|
||||
# Install ROS2 Foxy Fitzroy Desktop
|
||||
sudo apt update && sudo apt install locales
|
||||
sudo locale-gen en_US en_US.UTF-8
|
||||
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
locale # verify settings
|
||||
|
||||
## Setup Sources
|
||||
sudo apt install software-properties-common
|
||||
sudo add-apt-repository universe
|
||||
|
||||
sudo apt update && sudo apt install curl
|
||||
sudo apt install -y curl gnupg2 lsb-release
|
||||
|
||||
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
|
||||
# OLD: curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
|
||||
# OLD: sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
|
||||
|
||||
|
||||
## Install ROS2
|
||||
sudo apt-get update && sudo apt-get upgrade -y
|
||||
sudo apt install -y ros-foxy-ros-base
|
||||
sudo apt update && sudo apt install -y curl gnupg2 lsb-release
|
||||
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
|
||||
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
|
||||
sudo apt update && sudo apt install -y ros-foxy-ros-base
|
||||
source /opt/ros/foxy/setup.bash
|
||||
# Check to see if installed correctly
|
||||
echo "ROS_VERSION: "$ROS_VERSION
|
||||
|
||||
## Install other Tools
|
||||
|
||||
# Install rosdep
|
||||
sudo apt install -y python3-rosdep2
|
||||
rosdep update
|
||||
@ -65,6 +44,7 @@ cd colcon_ws
|
||||
colcon build
|
||||
|
||||
|
||||
|
||||
# Install network tools
|
||||
sudo apt install -y wireless-tools
|
||||
|
||||
@ -72,16 +52,16 @@ sudo apt install -y wireless-tools
|
||||
# Install Git
|
||||
sudo apt install -y git
|
||||
|
||||
|
||||
# Setup remote git from inside workspace
|
||||
cd ~/colcon_ws
|
||||
git init
|
||||
|
||||
|
||||
# Change the URL to your Git repository
|
||||
git remote add origin https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub.git
|
||||
git fetch --all
|
||||
git reset --hard origin/master
|
||||
|
||||
|
||||
# Install your project specific python packages
|
||||
# You can use pip3 as the install tool, eg:
|
||||
pip3 install python-can
|
||||
|
@ -1,70 +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"
|
||||
"srv/InclineControlSRV.srv"
|
||||
"srv/MosfetControlSRV.srv"
|
||||
"srv/PitchControlSRV.srv"
|
||||
"srv/RotationControlSRV.srv"
|
||||
"srv/SensorSRV.srv"
|
||||
"srv/WatchdogSRV.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()
|
@ -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.
|
@ -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
|
@ -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
|
@ -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>
|
@ -1,3 +0,0 @@
|
||||
string command
|
||||
---
|
||||
bool success
|
@ -1,6 +0,0 @@
|
||||
int32 incline
|
||||
bool store
|
||||
bool elevate
|
||||
bool upright
|
||||
---
|
||||
bool success
|
@ -1,3 +0,0 @@
|
||||
bool command
|
||||
---
|
||||
bool success
|
@ -1,11 +0,0 @@
|
||||
int32 degree
|
||||
uint32 speed
|
||||
bool status
|
||||
---
|
||||
bool success
|
||||
string error
|
||||
int32 present_position
|
||||
int32 present_load
|
||||
int32 present_temp
|
||||
uint32 present_v
|
||||
int32 up_cali
|
@ -1,7 +0,0 @@
|
||||
bool abs
|
||||
int32 degree
|
||||
int32 local_degree
|
||||
string center
|
||||
---
|
||||
bool success
|
||||
int32 present_pos
|
@ -1,3 +0,0 @@
|
||||
bool triggered
|
||||
---
|
||||
bool success
|
@ -1,4 +0,0 @@
|
||||
string command
|
||||
float32 value
|
||||
---
|
||||
bool success
|
@ -1,3 +0,0 @@
|
||||
string node_name
|
||||
---
|
||||
string node_name
|
@ -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 -->
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -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> = ....
|
||||
"""
|
||||
@ -246,7 +248,7 @@ class MinimalActionServer(Node):
|
||||
* act_callback_input: action callback function
|
||||
|
||||
Return:
|
||||
*
|
||||
*
|
||||
"""
|
||||
|
||||
def __init__(self, NODE_NAME, ACT_NAME, ACT_TYPE, act_callback_input=None):
|
||||
@ -258,19 +260,19 @@ class MinimalActionServer(Node):
|
||||
self.execute_callback= self.std_act_callback
|
||||
else:
|
||||
self.execute_callback = act_callback_input
|
||||
|
||||
|
||||
# Init above laying class "Node" (super class)
|
||||
super().__init__(self.NODE_NAME)
|
||||
print("\tStarting Action Server:\t%s"%(self.ACT_NAME))
|
||||
self._action_server = ActionServer(self, self.ACT_TYPE, self.ACT_NAME, self.execute_callback)
|
||||
|
||||
|
||||
|
||||
# standard action callback
|
||||
def std_act_callback(self, goal_handle):
|
||||
""" Standard Action Callback Method
|
||||
""" Standard Action Callback Method
|
||||
|
||||
Replace this method by inputting a custom callback method using 'act_callback_input'.
|
||||
This method MUST return a variable of the type 'action result',
|
||||
Replace this method by inputting a custom callback method using 'act_callback_input'.
|
||||
This method MUST return a variable of the type 'action result',
|
||||
eg. result = ACTION_TYPE.Result()
|
||||
"""
|
||||
self.get_logger().info('Executing goal...')
|
||||
@ -280,7 +282,7 @@ class MinimalActionServer(Node):
|
||||
#################
|
||||
result = self.ACT_TYPE.Result()
|
||||
return result
|
||||
|
||||
|
||||
#******************************************************************************#
|
||||
|
||||
class MinimalActionClient(Node):
|
||||
@ -292,21 +294,21 @@ class MinimalActionClient(Node):
|
||||
* act_callback_input: action callback function
|
||||
|
||||
Return:
|
||||
*
|
||||
*
|
||||
"""
|
||||
|
||||
def __init__(self, NODE_NAME, ACT_NAME, ACT_TYPE, act_callback_input=None):
|
||||
self.NODE_NAME = NODE_NAME
|
||||
self.ACT_NAME = ACT_NAME
|
||||
self.ACT_TYPE = ACT_TYPE
|
||||
|
||||
|
||||
# Init above laying class "Node" (super class)
|
||||
super().__init__(self.NODE_NAME)
|
||||
print("\tStarting Action Client for:\t%s"%(self.ACT_NAME))
|
||||
self._action_client = ActionClient(self, self.ACT_TYPE, self.ACT_NAME)
|
||||
|
||||
|
||||
def send_goal(self, input):
|
||||
return
|
||||
|
||||
|
||||
def abort_goal(self):
|
||||
return
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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()
|
@ -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
|
@ -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
|
@ -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>
|
Loading…
x
Reference in New Issue
Block a user