Skip to content

Commit

Permalink
Merge pull request #455 from husarion/ros2-lynx-merge
Browse files Browse the repository at this point in the history
Ros2 lynx merge
  • Loading branch information
KmakD authored Dec 6, 2024
2 parents f09439a + b01865e commit 99a62b5
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Launch arguments are largely common to both simulation and physical robot. Howev
||| `localization_mode` | Specifies the localization mode: <br/>- 'relative' `odometry/filtered` data is relative to the initial position and orientation. <br/>- 'enu' `odometry/filtered` data is relative to initial position and ENU (East North Up) orientation. <br/> ***string:*** `relative` (choices: `relative`, `enu`) |
||| `namespace` | Add namespace to all launched nodes. <br/> ***string:*** `env(ROBOT_NAMESPACE)` |
||| `publish_robot_state` | Whether to publish the default URDF of specified robot. <br/> ***bool:*** `True` |
||| `robot_model` | Specify robot model type. <br/> ***string:*** `env(ROBOT_MODEL)` (choices: `lynx`, `panther`) |
||| `robot_model` | Specify robot model type. <br/> ***string:*** `env(ROBOT_MODEL_NAME)` (choices: `lynx`, `panther`) |
||| `safety_bt_project_path` | Path to BehaviorTree project file, responsible for safety and shutdown management. <br/> ***string:*** [`SafetyBT.btproj`](./husarion_ugv_manager/behavior_trees/SafetyBT.btproj) |
||| `shutdown_hosts_config_path` | Path to file with list of hosts to request shutdown. <br/> ***string:*** [`shutdown_hosts.yaml`](./husarion_ugv_manager/config/shutdown_hosts.yaml) |
||| `use_ekf` | Enable or disable EKF. <br/> ***bool:*** `True` |
Expand Down
7 changes: 2 additions & 5 deletions husarion_ugv_bringup/launch/bringup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from husarion_ugv_utils.messages import welcome_msg
from launch import LaunchDescription
Expand Down Expand Up @@ -45,12 +44,10 @@ def generate_launch_description():
description="Add namespace to all launched nodes.",
)

robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")
robot_model = robot_model_dict[robot_model_env]
robot_model_name = EnvironmentVariable(name="ROBOT_MODEL_NAME", default_value="panther")
robot_serial_no = EnvironmentVariable(name="ROBOT_SERIAL_NO", default_value="----")
robot_version = EnvironmentVariable(name="ROBOT_VERSION", default_value="1.0")
welcome_info = welcome_msg(robot_model, robot_serial_no, robot_version)
welcome_info = welcome_msg(robot_model_name, robot_serial_no, robot_version)

controller_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
Expand Down
5 changes: 1 addition & 4 deletions husarion_ugv_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@ def generate_launch_description():
)

robot_model = LaunchConfiguration("robot_model")
robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")

robot_description_pkg = PythonExpression(["'", robot_model, "_description'"])
robot_description_common_dir = PathJoinSubstitution(["/config", robot_description_pkg])

declare_robot_model_arg = DeclareLaunchArgument(
"robot_model",
default_value=robot_model_dict[robot_model_env],
default_value=EnvironmentVariable(name="ROBOT_MODEL_NAME", default_value="panther"),
description="Specify robot model",
choices=["lynx", "panther"],
)
Expand Down
5 changes: 1 addition & 4 deletions husarion_ugv_gazebo/launch/simulate_robot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
Expand Down Expand Up @@ -94,11 +93,9 @@ def generate_launch_description():
description="Add namespace to all launched nodes.",
)

robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")
declare_robot_model_arg = DeclareLaunchArgument(
"robot_model",
default_value=robot_model_dict[robot_model_env],
default_value=EnvironmentVariable(name="ROBOT_MODEL_NAME", default_value="panther"),
description="Specify robot model",
choices=["lynx", "panther"],
)
Expand Down
5 changes: 1 addition & 4 deletions husarion_ugv_gazebo/launch/spawn_robot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from husarion_ugv_utils.messages import welcome_msg
from launch import LaunchDescription
Expand All @@ -40,11 +39,9 @@ def generate_launch_description():
)

robot_model = LaunchConfiguration("robot_model")
robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")
declare_robot_model_arg = DeclareLaunchArgument(
"robot_model",
default_value=robot_model_dict[robot_model_env],
default_value=EnvironmentVariable(name="ROBOT_MODEL_NAME", default_value="panther"),
description="Specify robot model",
choices=["lynx", "panther"],
)
Expand Down
4 changes: 3 additions & 1 deletion husarion_ugv_lights/config/user_animations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#
# For more examples and detailed documentation, please visit:
# https://github.com/husarion/panther_ros/blob/ros2/panther_lights/CONFIGURATION.md#defining-animations
#

user_animations: []

# Example including a simple custom animation:
#
# user_animations:
Expand Down
5 changes: 1 addition & 4 deletions husarion_ugv_lights/launch/lights.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, Shutdown
Expand Down Expand Up @@ -51,11 +50,9 @@ def generate_launch_description():
description="Add namespace to all launched nodes.",
)

robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")
declare_robot_model_arg = DeclareLaunchArgument(
"robot_model",
default_value=robot_model_dict[robot_model_env],
default_value=EnvironmentVariable(name="ROBOT_MODEL_NAME", default_value="panther"),
description="Specify robot model",
choices=["lynx", "panther"],
)
Expand Down
1 change: 0 additions & 1 deletion husarion_ugv_manager/src/lights_manager_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <string>
#include <vector>

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "behaviortree_ros2/ros_node_params.hpp"
#include "rclcpp/rclcpp.hpp"

Expand Down
3 changes: 1 addition & 2 deletions husarion_ugv_manager/src/safety_manager_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <utility>
#include <vector>

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "behaviortree_ros2/ros_node_params.hpp"
#include "rclcpp/rclcpp.hpp"

Expand Down Expand Up @@ -138,7 +137,7 @@ std::map<std::string, std::any> SafetyManagerNode::CreateSafetyInitialBlackboard
const double cpu_fan_off_temp = this->params_.cpu.temp.fan_off;
const double driver_fan_on_temp = this->params_.driver.temp.fan_on;
const double driver_fan_off_temp = this->params_.driver.temp.fan_off;
const double fan_turn_off_timeout = this->params_.fan_turn_off_timeout;
const float fan_turn_off_timeout = static_cast<float>(this->params_.fan_turn_off_timeout);

const std::map<std::string, std::any> safety_initial_bb = {
{"CPU_FAN_OFF_TEMP", cpu_fan_off_temp},
Expand Down
11 changes: 8 additions & 3 deletions husarion_ugv_manager/test/test_lights_behavior_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "gtest/gtest.h"

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "behaviortree_cpp/basic_types.h"
#include "rclcpp/rclcpp.hpp"

Expand Down Expand Up @@ -107,18 +108,22 @@ TestLightsBehaviorTree::TestLightsBehaviorTree()

std::vector<rclcpp::Parameter> TestLightsBehaviorTree::CreateTestParameters() const
{
const auto panther_manager_pkg_path =
ament_index_cpp::get_package_share_directory("husarion_ugv_manager");
const std::string bt_project_path = panther_manager_pkg_path + "/behavior_trees/LightsBT.btproj";

std::vector<std::string> plugin_libs;
plugin_libs.push_back("tick_after_timeout_bt_node");

std::vector<std::string> ros_plugin_libs;
ros_plugin_libs.push_back("call_set_led_animation_service_bt_node");

std::vector<rclcpp::Parameter> params;
params.push_back(rclcpp::Parameter("bt_project_path", bt_project_path));
params.push_back(rclcpp::Parameter("plugin_libs", plugin_libs));
params.push_back(rclcpp::Parameter("ros_plugin_libs", ros_plugin_libs));
params.push_back(rclcpp::Parameter("battery.animation_period.low", kLowBatteryAnimPeriod));
params.push_back(
rclcpp::Parameter("battery.animation_period.critical", kCriticalBatteryAnimPeriod));
params.push_back(rclcpp::Parameter("battery.anim_period.low", kLowBatteryAnimPeriod));
params.push_back(rclcpp::Parameter("battery.anim_period.critical", kCriticalBatteryAnimPeriod));

return params;
}
Expand Down
6 changes: 6 additions & 0 deletions husarion_ugv_manager/test/test_safety_behavior_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "gtest/gtest.h"

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "behaviortree_cpp/basic_types.h"
#include "rclcpp/rclcpp.hpp"

Expand Down Expand Up @@ -126,6 +127,10 @@ TestSafetyBehaviorTree::~TestSafetyBehaviorTree() { rclcpp::shutdown(); }

std::vector<rclcpp::Parameter> TestSafetyBehaviorTree::CreateTestParameters() const
{
const auto panther_manager_pkg_path =
ament_index_cpp::get_package_share_directory("husarion_ugv_manager");
const std::string bt_project_path = panther_manager_pkg_path + "/behavior_trees/SafetyBT.btproj";

std::vector<std::string> plugin_libs;
plugin_libs.push_back("tick_after_timeout_bt_node");
plugin_libs.push_back("shutdown_single_host_bt_node");
Expand All @@ -137,6 +142,7 @@ std::vector<rclcpp::Parameter> TestSafetyBehaviorTree::CreateTestParameters() co
ros_plugin_libs.push_back("call_trigger_service_bt_node");

std::vector<rclcpp::Parameter> params;
params.push_back(rclcpp::Parameter("bt_project_path", bt_project_path));
params.push_back(rclcpp::Parameter("plugin_libs", plugin_libs));
params.push_back(rclcpp::Parameter("ros_plugin_libs", ros_plugin_libs));
params.push_back(rclcpp::Parameter("fan_turn_off_timeout", kFanTurnOffTimeout));
Expand Down

0 comments on commit 99a62b5

Please sign in to comment.