Skip to content

Commit

Permalink
Skeleton of endpoint and service
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
  • Loading branch information
luca-della-vedova committed Jan 7, 2025
1 parent a0eff3c commit 8c09dbf
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nexus_endpoints.redf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ endpoints:
description: Register a workcell
type: service
service_name: /register_workcell
# Robot Arm Controller
service_type: nexus_orchestrator_msgs/srv/RegisterWorkcell
- title: Unregister Workcell Service
description: Unregister a workcell
type: service
service_name: /unregister_workcell
service_type: nexus_orchestrator_msgs/srv/UnregisterWorkcell
# Robot Arm Controller
- title: Controller Robot Trajectory Action
description: Send a controller action goal to a robot arm
type: action
Expand Down
21 changes: 21 additions & 0 deletions nexus_endpoints/nexus_endpoints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <nexus_orchestrator_msgs/srv/register_workcell.hpp>
#include <nexus_orchestrator_msgs/srv/remove_pending_task.hpp>
#include <nexus_orchestrator_msgs/srv/signal_workcell.hpp>
#include <nexus_orchestrator_msgs/srv/unregister_workcell.hpp>
#include <nexus_transporter_msgs/action/transport.hpp>
#include <nexus_transporter_msgs/srv/is_transporter_available.hpp>
#include <trajectory_msgs/msg/joint_trajectory.hpp>
Expand Down Expand Up @@ -255,6 +256,26 @@ class RegisterWorkcellService {
}
};

class UnregisterWorkcellService {
public:
using ServiceType = nexus_orchestrator_msgs::srv::UnregisterWorkcell;

static inline std::string service_name() {
const std::string name = "/unregister_workcell";
return name;
}

template<typename NodePtrT, typename CallbackT>
static rclcpp::Service<UnregisterWorkcellService::ServiceType>::SharedPtr create_service(NodePtrT node, CallbackT&& callback) {
return node->template create_service<UnregisterWorkcellService::ServiceType>(UnregisterWorkcellService::service_name(), std::forward<CallbackT>(callback));
}

template<typename NodePtrT>
static rclcpp::Client<UnregisterWorkcellService::ServiceType>::SharedPtr create_client(NodePtrT node) {
return node->template create_client<UnregisterWorkcellService::ServiceType>(UnregisterWorkcellService::service_name());
}
};

class ControllerRobotTrajectoryAction {
public:
using ActionType = control_msgs::action::FollowJointTrajectory;
Expand Down
1 change: 1 addition & 0 deletions nexus_msgs/nexus_orchestrator_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set(srv_files
"srv/RegisterWorkcell.srv"
"srv/RemovePendingTask.srv"
"srv/SignalWorkcell.srv"
"srv/UnregisterWorkcell.srv"
)

rosidl_generate_interfaces(${PROJECT_NAME}
Expand Down
19 changes: 19 additions & 0 deletions nexus_msgs/nexus_orchestrator_msgs/srv/UnregisterWorkcell.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Service to unregister a workcell with the system orchestrator

# Description provided by the workcell for unregistration
WorkcellDescription description

---

# True if workcell is removed successfully
bool success

int32 error_code
int32 ERROR_UNKNOWN=0
# System orchestrator is not ready
int32 ERROR_NOT_READY=1
# The workcell was not registered
int32 ERROR_NOT_REGISTERED=2

# [OPTIONAL] message for debugging or indicating cause of success/failure
string message

0 comments on commit 8c09dbf

Please sign in to comment.