Skip to content

Commit

Permalink
Added action template
Browse files Browse the repository at this point in the history
  • Loading branch information
esteve committed Nov 28, 2022
1 parent b9f3136 commit b3f0eef
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 0 additions & 3 deletions examples/minimal_action_client_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,3 @@ version = "0.3"

[dependencies.action_msgs]
version = "*"

[package.metadata.ros]
install_to_share = ["launch"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::{Error, Result};
fn main() -> Result<(), Error> {
let context = rclrs::Context::new(env::args())?;

let mut node = rclrs::create_node(&context, "minimal_action_server")?;
let node = rclrs::create_node(&context, "minimal_action_server")?;

rclrs::spin(&node).map_err(|err| err.into())
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ foreach(_idl_file ${rosidl_generate_interfaces_ABS_IDL_FILES})

if(_parent_folder STREQUAL "msg")
set(_has_msg TRUE)
set(_idl_file_without_actions ${_idl_file_without_actions} ${_idl_file})
set(_idl_files ${_idl_files} ${_idl_file})
elseif(_parent_folder STREQUAL "srv")
set(_has_srv TRUE)
set(_idl_file_without_actions ${_idl_file_without_actions} ${_idl_file})
set(_idl_files ${_idl_files} ${_idl_file})
elseif(_parent_folder STREQUAL "action")
set(_has_action TRUE)
message(WARNING "Rust actions generation is not implemented")
set(_idl_files ${_idl_files} ${_idl_file})
else()
message(FATAL_ERROR "Interface file with unknown parent folder: ${_idl_file}")
endif()
Expand Down Expand Up @@ -107,12 +107,13 @@ endforeach()
set(target_dependencies
"${rosidl_generator_rs_BIN}"
${rosidl_generator_rs_GENERATOR_FILES}
"${rosidl_generator_rs_TEMPLATE_DIR}/action.rs.em"
"${rosidl_generator_rs_TEMPLATE_DIR}/msg_idiomatic.rs.em"
"${rosidl_generator_rs_TEMPLATE_DIR}/msg_rmw.rs.em"
"${rosidl_generator_rs_TEMPLATE_DIR}/msg.rs.em"
"${rosidl_generator_rs_TEMPLATE_DIR}/srv.rs.em"
${rosidl_generate_interfaces_ABS_IDL_FILES}
${_idl_file_without_actions}
${_idl_files}
${_dependency_files})
foreach(dep ${target_dependencies})
if(NOT EXISTS "${dep}")
Expand All @@ -125,7 +126,7 @@ rosidl_write_generator_arguments(
"${generator_arguments_file}"
PACKAGE_NAME "${PROJECT_NAME}"
IDL_TUPLES "${rosidl_generate_interfaces_IDL_TUPLES}"
ROS_INTERFACE_FILES "${_idl_file_without_actions}"
ROS_INTERFACE_FILES "${_idl_files}"
ROS_INTERFACE_DEPENDENCIES "${_dependencies}"
OUTPUT_DIR "${_output_path}"
TEMPLATE_DIR "${rosidl_generator_rs_TEMPLATE_DIR}"
Expand Down
9 changes: 9 additions & 0 deletions rosidl_generator_rs/resource/action.rs.em
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@{
TEMPLATE(
'msg_idiomatic.rs.em',
package_name=package_name, interface_path=interface_path,
msg_specs=msg_specs,
get_rs_name=get_rs_name, get_rmw_rs_type=get_rmw_rs_type,
get_idiomatic_rs_type=get_idiomatic_rs_type,
constant_value_to_rs=constant_value_to_rs)
}@

0 comments on commit b3f0eef

Please sign in to comment.