@@ -74,11 +74,19 @@ void TaskboardSpawnerNode::SpawnFromConfig(const std::string& config_path) {
7474 const auto & components = logic_.GetComponents ();
7575 for (const auto & [key, cfg] : components) {
7676 if (cfg.entity_present ) {
77+ std::string asset_name = key;
78+ // Map config keys to actual asset names in the catalog
79+ if (key.find (" nic_rail" ) != std::string::npos) {
80+ asset_name = " nic_card_mount" ;
81+ } else if (key.find (" sc_rail" ) != std::string::npos) {
82+ asset_name = " sc_port" ;
83+ }
84+
7785 double x, y, z, qx, qy, qz, qw;
7886 if (logic_.ComputeRelativePose (key, x, y, z, qx, qy, qz, qw)) {
79- RCLCPP_INFO (this ->get_logger (), " COMPUTED RELATIVE POSE [%s]: (x=%f, y=%f, z=%f, qx=%f, qy=%f, qz=%f, qw=%f)" ,
80- key.c_str (), x, y, z, qx, qy, qz, qw);
81- SpawnComponent (key , cfg.entity_name , x, y, z, qx, qy, qz, qw, true , " task_board_base" );
87+ RCLCPP_INFO (this ->get_logger (), " COMPUTED RELATIVE POSE [%s] -> Asset: %s : (x=%f, y=%f, z=%f, qx=%f, qy=%f, qz=%f, qw=%f)" ,
88+ key.c_str (), asset_name. c_str (), x, y, z, qx, qy, qz, qw);
89+ SpawnComponent (asset_name , cfg.entity_name , x, y, z, qx, qy, qz, qw, true , " task_board_base" );
8290 }
8391 }
8492 }
@@ -183,10 +191,45 @@ void TaskboardSpawnerNode::HandleUpdateComponent(
183191
184192 double x, y, z, qx, qy, qz, qw;
185193 if (logic_.ComputeRelativePose (request->component_name , x, y, z, qx, qy, qz, qw)) {
186-
187- // Call UpdateTransform gRPC or similar
188- response->success = true ;
189- response->message = " Successfully updated transform (Placeholder)" ;
194+ auto it = logic_.GetComponents ().find (request->component_name );
195+ if (it == logic_.GetComponents ().end ()) {
196+ response->success = false ;
197+ response->message = " Component not found in config" ;
198+ return ;
199+ }
200+ std::string entity_name = it->second .entity_name ;
201+
202+ intrinsic_proto::world::UpdateTransformRequest update_req;
203+ update_req.set_world_id (" init_world" );
204+
205+ auto * node_a = update_req.mutable_node_a ();
206+ node_a->mutable_by_name ()->mutable_object ()->set_object_name (" task_board_base" );
207+
208+ auto * node_b = update_req.mutable_node_b ();
209+ node_b->mutable_by_name ()->mutable_object ()->set_object_name (entity_name);
210+
211+ auto * pose = update_req.mutable_a_t_b ();
212+ pose->mutable_position ()->set_x (x);
213+ pose->mutable_position ()->set_y (y);
214+ pose->mutable_position ()->set_z (z);
215+ pose->mutable_orientation ()->set_x (qx);
216+ pose->mutable_orientation ()->set_y (qy);
217+ pose->mutable_orientation ()->set_z (qz);
218+ pose->mutable_orientation ()->set_w (qw);
219+
220+ update_req.set_view (intrinsic_proto::world::ObjectView::BASIC);
221+
222+ intrinsic_proto::world::UpdateTransformResponse update_resp;
223+ grpc::ClientContext context;
224+ grpc::Status status = object_world_stub_->UpdateTransform (&context, update_req, &update_resp);
225+
226+ if (status.ok ()) {
227+ response->success = true ;
228+ response->message = " Successfully updated transform" ;
229+ } else {
230+ response->success = false ;
231+ response->message = " Failed to update transform: " + status.error_message ();
232+ }
190233 } else {
191234 response->success = false ;
192235 response->message = " Failed to compute relative pose" ;
0 commit comments