Skip to content

Commit

Permalink
Fix some tests and set hash in vcs
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Nov 27, 2024
1 parent a9a291d commit b522f3b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 29 deletions.
8 changes: 4 additions & 4 deletions rosbot/rosbot_hardware.repos
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ repositories:
rosbot_hardware_interfaces:
type: git
url: https://github.com/husarion/rosbot_hardware_interfaces.git
version: main
version: da1805839aaa21b8341a9c39498c96d9a1a4f87d
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: main
version: 217b09830f5f42930098b9992eda41710702b625
micro_ros_msgs:
type: git
url: https://github.com/micro-ROS/micro_ros_msgs.git
version: humble
version: 10be4d005fbc7d8dd60dbb213b65f4171419bfe9
micro-ROS-Agent:
type: git
url: https://github.com/micro-ROS/micro-ROS-Agent.git
version: humble
version: 30377bbd86ff7ea93ca69a3b37997fd235385e1f
2 changes: 1 addition & 1 deletion rosbot/rosbot_simulation.repos
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ repositories:
husarion_gz_worlds:
type: git
url: https://github.com/husarion/husarion_gz_worlds
version: main
version: c0ff83a476f6e0bc250c763a806bf1769a00f515
ros2_controllers: # Bug: There is no nice way to change `sensor_name` imu_bradcaster param when spawning multiple robots -> ros2_control refer only to single imu entity
type: git
url: https://github.com/husarion/ros2_controllers/
Expand Down
30 changes: 14 additions & 16 deletions rosbot_bringup/test/test_multirobot_ekf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
from launch_ros.substitutions import FindPackageShare
from test_utils import BringupTestNode

robot_names = ["robot1", "robot2", "robot3"]
robot_names = ["robot1", "robot2"]


@launch_pytest.fixture
def generate_test_description():
rosbot_bringup = FindPackageShare("rosbot_bringup")
actions = []
for i in range(len(robot_names)):
for robot_name in robot_names:
bringup_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
Expand All @@ -45,7 +45,7 @@ def generate_test_description():
launch_arguments={
"use_sim": "False",
"mecanum": "False",
"namespace": robot_names[i],
"namespace": robot_name,
}.items(),
)

Expand All @@ -56,19 +56,17 @@ def generate_test_description():

@pytest.mark.launch(fixture=generate_test_description)
def test_multirobot_bringup_startup_success():
rclpy.init()
for robot_name in robot_names:
rclpy.init()
try:
node = BringupTestNode("test_bringup", namespace=robot_name)
node.create_test_subscribers_and_publishers()
node.start_publishing_fake_hardware()
node = BringupTestNode("test_bringup", namespace=robot_name)
node.create_test_subscribers_and_publishers()
node.start_publishing_fake_hardware()

node.start_node_thread()
msgs_received_flag = node.odom_msg_event.wait(timeout=20.0)
assert msgs_received_flag, (
f"Expected {robot_name}/odometry/filtered message but it was not received. "
"Check robot_localization!"
)
node.start_node_thread()
msgs_received_flag = node.odom_msg_event.wait(timeout=20.0)
assert msgs_received_flag, (
f"Expected {robot_name}/odometry/filtered message but it was not received. "
"Check robot_localization!"
)

finally:
rclpy.shutdown()
rclpy.shutdown()
12 changes: 4 additions & 8 deletions rosbot_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Import necessary modules
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, TimerAction
from launch.conditions import UnlessCondition
Expand All @@ -27,7 +26,6 @@
from launch_ros.actions import Node, SetParameter
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():
namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
Expand Down Expand Up @@ -86,8 +84,6 @@ def generate_launch_description():
use_sim,
" namespace:=",
namespace,
# Uncomment the line below if you need to include the 'use_ros2_control' parameter
# " use_ros2_control:=True",
]
)
robot_description = {"robot_description": robot_description_content}
Expand Down Expand Up @@ -137,7 +133,7 @@ def generate_launch_description():
"--controller-manager",
controller_manager_name,
"--controller-manager-timeout",
"10",
"20",
],
)

Expand All @@ -149,7 +145,7 @@ def generate_launch_description():
"--controller-manager",
controller_manager_name,
"--controller-manager-timeout",
"10",
"20",
],
)

Expand All @@ -161,11 +157,11 @@ def generate_launch_description():
"--controller-manager",
controller_manager_name,
"--controller-manager-timeout",
"10",
"20",
],
)

# Wrap the spawner nodes in a TimerAction to delay execution by 2 seconds
# Wrap the spawner nodes in a TimerAction to delay execution by 1 seconds
delayed_spawner_nodes = TimerAction(
period=1.0,
actions=[
Expand Down

0 comments on commit b522f3b

Please sign in to comment.