Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jazzy devel #113

Merged
merged 15 commits into from
Aug 7, 2024
18 changes: 9 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
black:
name: Black
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -19,7 +19,7 @@ jobs:

spellcheck:
name: Spellcheck
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -28,12 +28,12 @@ jobs:

industrial_ci:
name: Industrial CI
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [humble]
ROS_DISTRO: [jazzy]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -49,19 +49,19 @@ jobs:
python3 -m pip install -U vcstool
vcs import src < src/rosbot/rosbot_hardware.repos
vcs import src < src/rosbot/rosbot_simulation.repos
cp -r src/ros2_controllers/diff_drive_controller src/
cp -r src/ros2_controllers/imu_sensor_broadcaster src/
rm -rf src/ros2_controllers

# Package micro_ros_msgs does not have industrial ci and tests does not pass.
# For more information see https://github.com/micro-ROS/micro_ros_msgs/issues/7
- name: Leave only ROSbot tests
shell: bash
run: |
sed '/if(BUILD_TESTING)/,/endif()/d' src/diff_drive_controller/CMakeLists.txt -i
sed '/if(BUILD_TESTING)/,/endif()/d' src/imu_sensor_broadcaster/CMakeLists.txt -i
sed '/if(BUILD_TESTING)/,/endif()/d' src/micro_ros_msgs/CMakeLists.txt -i

- name: Fix pip
shell: bash
run: |
echo -e "[global]\nbreak-system-packages = true" >> ~/.config/pip/pip.conf

- name: Running ROS Industrial CI
uses: ros-industrial/industrial_ci@master
env:
Expand Down
3 changes: 2 additions & 1 deletion rosbot/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<depend>rosbot_bringup</depend>
<depend>rosbot_controller</depend>
<depend>rosbot_description</depend>
<depend>rosbot_utils</depend>

<depend condition="($HUSARION_ROS_BUILD == hardware)">rosbot_utils</depend>

<depend condition="($HUSARION_ROS_BUILD == simulation)">rosbot_gazebo</depend>

Expand Down
16 changes: 5 additions & 11 deletions rosbot/rosbot_hardware.repos
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
repositories:
# jazzy-devel
rosbot_hardware_interfaces:
type: git
url: https://github.com/husarion/rosbot_hardware_interfaces.git
version: main
version: jazzy-devel
ros_components_description:
type: git
url: https://github.com/husarion/ros_components_description.git
version: 1cb25600afa5941d21d48c0af8e63ad2eb3afaa0
husarion_controllers:
type: git
url: https://github.com/husarion/husarion_controllers
version: 217b09830f5f42930098b9992eda41710702b625
# Waiting for backporting to the humble version
# https://github.com/ros-controls/ros2_controllers/pull/726 and
# https://github.com/ros-controls/ros2_controllers/pull/831
ros2_controllers:
type: git
url: https://github.com/delihus/ros2_controllers
version: humble
version: jazzy
micro_ros_msgs:
type: git
url: https://github.com/micro-ROS/micro_ros_msgs.git
version: humble
version: jazzy
micro-ROS-Agent:
type: git
url: https://github.com/micro-ROS/micro-ROS-Agent.git
version: humble
version: jazzy
3 changes: 1 addition & 2 deletions rosbot_controller/config/diff_drive_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
tf_frame_prefix_enable: false
use_namespace_as_sensor_name_prefix: true

sensor_name: imu
sensor_name: <robot_namespace>/imu
frame_id: imu_link
static_covariance_orientation: [1.9e-3, 0.0, 0.0, 0.0, 1.9e-3, 0.0, 0.0, 0.0, 1.9e-3] # Values taken from datasheet
static_covariance_angular_velocity: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0e-3] # Values measured experimentally
Expand Down Expand Up @@ -60,7 +60,6 @@

cmd_vel_timeout: 0.5
#publish_limited_velocity: true
use_stamped_vel: false

# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
Expand Down
3 changes: 1 addition & 2 deletions rosbot_controller/config/mecanum_drive_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
tf_frame_prefix_enable: false
use_namespace_as_sensor_name_prefix: true

sensor_name: imu
sensor_name: <robot_namespace>/imu
frame_id: imu_link
static_covariance_orientation: [1.9e-3, 0.0, 0.0, 0.0, 1.9e-3, 0.0, 0.0, 0.0, 1.9e-3] # Values taken from datasheet
static_covariance_angular_velocity: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0e-3] # Values based on diff_drive
Expand Down Expand Up @@ -59,7 +59,6 @@

cmd_vel_timeout: 0.5
#publish_limited_velocity: true
use_stamped_vel: false

# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
Expand Down
12 changes: 9 additions & 3 deletions rosbot_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
)
from launch_ros.actions import Node, SetParameter
from launch_ros.substitutions import FindPackageShare
from nav2_common.launch import ReplaceString


def generate_launch_description():
Expand Down Expand Up @@ -109,26 +110,31 @@ def generate_launch_description():
)
robot_description = {"robot_description": robot_description_content}

robot_controllers = PathJoinSubstitution(
robot_controllers_config = PathJoinSubstitution(
[
FindPackageShare("rosbot_controller"),
"config",
controller_config_name,
]
)

namespaced_robot_controllers_config = ReplaceString(
source_file=robot_controllers_config,
replacements={"<robot_namespace>": namespace, "//": "/"},
)

control_node = Node(
package="controller_manager",
executable="ros2_control_node",
parameters=[
robot_description,
robot_controllers,
namespaced_robot_controllers_config,
],
remappings=[
("imu_sensor_node/imu", "/_imu/data_raw"),
("~/motors_cmd", "/_motors_cmd"),
("~/motors_response", "/_motors_response"),
("rosbot_base_controller/cmd_vel_unstamped", "cmd_vel"),
("rosbot_base_controller/cmd_vel", "cmd_vel"),
("/tf", "tf"),
("/tf_static", "tf_static"),
],
Expand Down
1 change: 1 addition & 0 deletions rosbot_controller/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>
<exec_depend>nav2_common</exec_depend>

<exec_depend>xacro</exec_depend>
<exec_depend>controller_manager</exec_depend>
Expand Down
6 changes: 3 additions & 3 deletions rosbot_description/urdf/rosbot_macro.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

<xacro:if value="$(arg use_sim)">
<xacro:if value="${simulation_engine == 'ignition-gazebo'}">
<plugin>ign_ros2_control/IgnitionSystem</plugin>
<plugin>gz_ros2_control/GazeboSimSystem</plugin>
</xacro:if>
<xacro:if value="${simulation_engine == 'webots'}">
<plugin>webots_ros2_control::Ros2ControlSystem</plugin>
Expand Down Expand Up @@ -121,7 +121,7 @@
<xacro:if value="${use_sim}">
<xacro:if value="${simulation_engine == 'ignition-gazebo'}">
<gazebo>
<plugin filename="ign_ros2_control-system" name="ign_ros2_control::IgnitionROS2ControlPlugin">
<plugin filename="gz_ros2_control-system" name="gz_ros2_control::GazeboSimROS2ControlPlugin">

<xacro:if value="${mecanum}">
<parameters>$(find rosbot_controller)/config/mecanum_drive_controller.yaml</parameters>
Expand All @@ -134,7 +134,7 @@
<xacro:unless value="${namespace == 'None'}">
<namespace>${namespace}</namespace>
</xacro:unless>
<remapping>rosbot_base_controller/cmd_vel_unstamped:=cmd_vel</remapping>
<remapping>rosbot_base_controller/cmd_vel:=cmd_vel</remapping>
<remapping>/tf:=tf</remapping>
</ros>
</plugin>
Expand Down
28 changes: 15 additions & 13 deletions rosbot_description/urdf/wheel.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,21 @@
</inertial>
</link>

<gazebo reference="${side}_wheel_link" xmlns:ignition="http://ignitionrobotics.org/schema">
<collision>
<surface>
<friction>
<ode>
<mu>1.0</mu>
<mu2>0.0</mu2>
<fdir1 ignition:expressed_in="base_link">${fdir}</fdir1>
</ode>
</friction>
</surface>
</collision>
</gazebo>
<xacro:if value="${mecanum}">
<gazebo reference="${side}_wheel_link" xmlns:ignition="http://ignitionrobotics.org/schema">
<collision>
<surface>
<friction>
<ode>
<mu>1.0</mu>
<mu2>0.0</mu2>
<fdir1 ignition:expressed_in="base_link">${fdir}</fdir1>
</ode>
</friction>
</surface>
</collision>
</gazebo>
</xacro:if>

</xacro:macro>
</robot>
4 changes: 2 additions & 2 deletions rosbot_gazebo/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
version can chosen using GZ_VERSION (or IGNITION_VERSION) env variable,
for details refer to the ros_gz_sim package -->
<exec_depend>ros_gz_bridge</exec_depend>
<exec_depend>ign_ros2_control</exec_depend>
<exec_depend>gz_ros2_control</exec_depend>
<exec_depend>nav2_common</exec_depend>

<test_depend>python3-pytest</test_depend>
Expand All @@ -35,7 +35,7 @@
<test_depend>launch_pytest</test_depend>

<test_depend>tf_transformations</test_depend>
<test_depend>python-transforms3d-pip</test_depend>
<!-- <test_depend>python-transforms3d-pip</test_depend> -->
<test_depend>nav_msgs</test_depend>
<test_depend>geometry_msgs</test_depend>

Expand Down
29 changes: 25 additions & 4 deletions rosbot_utils/rosbot_utils/flash-firmware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

# Copyright 2024 Husarion sp. z o.o.
#
Expand All @@ -25,6 +25,20 @@
import gpiod
import sh

def get_raspberry_pi_model():
try:
with open("/proc/cpuinfo", "r") as f:
for line in f:
if "Model" in line:
model_info = line.split(":")[1].strip()
if "Raspberry Pi 4" in model_info:
return "Raspberry Pi 4"
elif "Raspberry Pi 5" in model_info:
return "Raspberry Pi 5"
else:
return "Unknown Raspberry Pi Model"
except FileNotFoundError:
return "Not a Raspberry Pi"

class FirmwareFlasher:
def __init__(self, sys_arch, binary_file):
Expand Down Expand Up @@ -53,12 +67,19 @@ def __init__(self, sys_arch, binary_file):

elif self.sys_arch == "aarch64":
# Setups RPi pins
print("Device: RPi\n")
model = get_raspberry_pi_model()
print(f"Device: {model}\n")
self.serial_port = "/dev/ttyAMA0"
gpio_chip = "/dev/gpiochip0"

if model == "Raspberry Pi 4":
gpio_chip = "/dev/gpiochip0"
elif model == "Raspberry Pi 5":
gpio_chip = "/dev/gpiochip4"
else:
gpio_chip = "/dev/gpiochip0" # Default or error handling

boot0_pin_no = 17
reset_pin_no = 18

else:
print("Unknown device...")

Expand Down
11 changes: 6 additions & 5 deletions rosbot_utils/rosbot_utils/flash_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import subprocess
import os
import sys
import argparse
import signal
import glob
import requests
import os
import signal
import subprocess
import sys

import ament_index_python.packages
import requests

# Global variable to hold the subprocess reference
subproc = None
Expand Down
2 changes: 1 addition & 1 deletion tools/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG ROS_DISTRO=humble
ARG ROS_DISTRO=jazzy
ARG PREFIX=
ARG ROSBOT_FW_RELEASE=0.8.0

Expand Down
2 changes: 1 addition & 1 deletion tools/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG ROS_DISTRO=humble
ARG ROS_DISTRO=jazzy
ARG PREFIX=
ARG HUSARION_ROS_BUILD_TYPE=hardware

Expand Down
Loading