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

feat(controllers)!: remove robot description parameter #186

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Release Versions:

- [5.1.0](#510)
- [5.0.2](#502)
- [5.0.1](#501)
- [5.0.0](#500)
Expand All @@ -18,6 +19,10 @@ Release Versions:
- [2.1.1](#211)
- [2.1.0](#210)

## Upcoming changes

feat(controllers)!: remove robot description parameter (#186)

## 5.1.0

### December 16th, 2024
Expand Down
4 changes: 2 additions & 2 deletions aica-package.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#syntax=ghcr.io/aica-technology/package-builder:v1.3.0
#syntax=ghcr.io/aica-technology/package-builder:v1.3.2

[metadata]
version = "5.1.0"
Expand All @@ -9,7 +9,7 @@ name = "modulo"

[build]
type = "ros"
image = "v2.0.0-jazzy"
image = "v2.1.0-rc1-jazzy"

[build.dependencies]
"@aica/foss/control-libraries" = "v9.0.0"
Expand Down
4 changes: 1 addition & 3 deletions source/modulo_controllers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ parameters, predicates, and services.
It supports the following parameters:

- `hardware_name` [string]: the name of the hardware interface
- `robot_description` [string]: the string formatted content of the controller's URDF description
- `joints` [string_array]: a vector of joint names that the controller will claim
- `activation_timeout` [double]: the seconds to wait for valid data on state interfaces before activating
- `input_validity_period` [double]: the maximum age of an input state before discarding it as expired
Expand Down Expand Up @@ -43,8 +42,7 @@ joint command or access the joint state using the `set_joint_command()` and `get

### Robot model and URDF

If a controller needs a robot model, a `robot_model::Model` will be configured from URDF information. To support this,
the `robot_description` must be specified.
If a controller needs a robot model, a `robot_model::Model` will be configured from URDF information.

The robot model is used to calculate the CartesianState of a task frame from the JointState using forward kinematics,
which is available to derived classes using the `get_cartesian_state()` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@
"optional": true,
"internal": true
},
{
"display_name": "Robot description",
"description": "The string formatted content of the controller's URDF description",
"parameter_name": "robot_description",
"parameter_type": "string",
"default_value": null,
"optional": true,
"internal": true
},
{
"display_name": "Activation timeout",
"description": "The seconds to wait for valid data on the state interfaces before activating (in seconds)",
Expand Down
3 changes: 0 additions & 3 deletions source/modulo_controllers/src/ControllerInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn Contro

try {
add_parameter(std::make_shared<Parameter<std::string>>("hardware_name"), "The name of the hardware interface");
add_parameter(
std::make_shared<Parameter<std::string>>("robot_description"),
"The string formatted content of the controller's URDF description");
add_parameter(
std::make_shared<Parameter<std::vector<std::string>>>("joints"),
"A vector of joint names that the controller will claim");
Expand Down
38 changes: 18 additions & 20 deletions source/modulo_controllers/src/RobotControllerInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,25 @@ rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn RobotC
}

rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn RobotControllerInterface::on_configure() {
if (*get_parameter("robot_description")) {
std::stringstream timestamp;
timestamp << std::time(nullptr);
auto urdf_path = "/tmp/" + hardware_name_ + "_" + timestamp.str();
try {
robot_model::Model::create_urdf_from_string(get_parameter_value<std::string>("robot_description"), urdf_path);
if (load_geometries_) {
robot_ = std::make_shared<robot_model::Model>(hardware_name_, urdf_path, [](const std::string& package_name) {
return ament_index_cpp::get_package_share_directory(package_name) + "/";
});
RCLCPP_DEBUG(get_node()->get_logger(), "Generated robot model with collision features");
} else {
robot_ = std::make_shared<robot_model::Model>(hardware_name_, urdf_path);
RCLCPP_DEBUG(get_node()->get_logger(), "Generated robot model");
}
} catch (const std::exception& ex) {
RCLCPP_WARN(
get_node()->get_logger(),
"Could not generate robot model with temporary urdf from string content at path %s: %s", urdf_path.c_str(),
ex.what());
std::stringstream timestamp;
timestamp << std::time(nullptr);
auto urdf_path = "/tmp/" + hardware_name_ + "_" + timestamp.str();
try {
robot_model::Model::create_urdf_from_string(get_robot_description(), urdf_path);
if (load_geometries_) {
robot_ = std::make_shared<robot_model::Model>(hardware_name_, urdf_path, [](const std::string& package_name) {
return ament_index_cpp::get_package_share_directory(package_name) + "/";
});
RCLCPP_DEBUG(get_node()->get_logger(), "Generated robot model with collision features");
} else {
robot_ = std::make_shared<robot_model::Model>(hardware_name_, urdf_path);
RCLCPP_DEBUG(get_node()->get_logger(), "Generated robot model");
}
} catch (const std::exception& ex) {
RCLCPP_WARN(
get_node()->get_logger(),
"Could not generate robot model with temporary urdf from string content at path %s: %s", urdf_path.c_str(),
ex.what());
}
if (robot_model_required_ && robot_ == nullptr) {
RCLCPP_ERROR(get_node()->get_logger(), "Robot model is not available even though it's required by the controller.");
Expand Down
Loading