ASCO Aerial Autonomy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pick_place_functors.h
Go to the documentation of this file.
1 #pragma once
9 #include <glog/logging.h>
10 #include <thread>
11 
18 template <class LogicStateMachineT>
19 struct PickGuard_
20  : EventAgnosticGuardFunctor<UAVArmSystem, LogicStateMachineT> {
21  bool guard(UAVArmSystem &robot_system) {
22  VLOG(1) << "Grip Object";
23  bool success = robot_system.grip(true);
24  // \todo this wait logic should be done on the arm plugin side and we should
25  // be checking a status asynchronously for grip completion
26  std::this_thread::sleep_for(std::chrono::milliseconds(1000));
27  if (!success) {
28  LOG(WARNING) << "Failed to send grip command!";
29  robot_system.grip(false);
30  return false;
31  }
32  VLOG(1) << "Done Gripping!";
33  return true;
34  }
35 };
36 
42 template <class LogicStateMachineT>
48  LogicStateMachineT, VisualServoingControllerArmConnector>,
50  LogicStateMachineT, VisualServoingControllerDroneConnector,
51  false>>>;
57 template <class LogicStateMachineT>
62 
69 template <class LogicStateMachineT>
71  : EventAgnosticGuardFunctor<UAVArmSystem, LogicStateMachineT> {
72  bool guard(UAVArmSystem &robot_system_) {
73  Position tracking_vector;
74  return (robot_system_.getTrackingVector(tracking_vector) &&
75  robot_system_.enabled());
76  }
77 };
78 
84 template <class LogicStateMachineT, int TransformIndex>
86  : EventAgnosticActionFunctor<UAVArmSystem, LogicStateMachineT> {
87  void run(UAVArmSystem &robot_system) {
88  VLOG(1) << "Setting Goal for visual servoing arm connector!";
89  robot_system.setGoal<VisualServoingControllerArmConnector, tf::Transform>(
90  robot_system.armGoalTransform(TransformIndex));
91  // Also ensure the gripper is open before going to pick objects
92  robot_system.grip(false);
93  }
94 };
95 
101 template <class LogicStateMachineT>
102 using PickState_ = BaseState<UAVArmSystem, LogicStateMachineT,
104 
111 template <class LogicStateMachineT>
112 class PrePickState_ : public PickState_<LogicStateMachineT> {};
Logic to abort if controller status is critical.
Definition: hovering_functors.h:57
Logic to grab an object, sleep for few seconds Abort UAV, Arm controllers.
Definition: pick_place_functors.h:19
UAV vision system with an arm.
Definition: uav_arm_system.h:12
Base state for all states in logic state machine.
Definition: base_state.h:24
State that uses position control functor to reach a desired goal prior to picking.
Definition: pick_place_functors.h:112
void run(UAVArmSystem &robot_system)
Override this run function for different sub classes. This function performs the logic checking for e...
Definition: pick_place_functors.h:87
Action functor that does not require the event triggering it.
Definition: base_functors.h:113
void setGoal(GoalT goal)
sets goal to the connector and swaps the active connector with the specified connector type...
Definition: base_robot_system.h:59
bool grip(bool grip_action)
Public API call to grip/ungrip an object.
Definition: arm_system.h:51
bool getTrackingVector(Position &pos)
Get the direction vector of the tracking target in the global frame.
Definition: uav_vision_system.h:44
A visual servoing controller that uses a tracker output as feedback.
Definition: visual_servoing_controller_drone_connector.h:16
action for checking arm status.
Definition: arm_functors.h:109
bool enabled() const
If arm is enabled return.
Definition: arm_system.h:145
bool guard(UAVArmSystem &robot_system_)
Override this run function for different sub classes. This function performs the logic checking for e...
Definition: pick_place_functors.h:72
tf::Transform armGoalTransform(int i)
getter for transfrom from arm to object
Definition: uav_arm_system.h:71
Internal action when hovering.
Definition: hovering_functors.h:21
Set arm goal and set grip to false to start with.
Definition: pick_place_functors.h:85
Check tracking is valid before starting visual servoing and arm is enabled before picking objects...
Definition: pick_place_functors.h:70
Check if hardware is allowing to switch sdk mode.
Definition: manual_control_functors.h:59
bool guard(UAVArmSystem &robot_system)
Override this run function for different sub classes. This function performs the logic checking for e...
Definition: pick_place_functors.h:21
Guard functor that does not require the event triggering it.
Definition: base_functors.h:157
Action sequence that runs until one of the actions returns false.
Definition: shorting_action_sequence.h:46
Store 3D position.
Definition: position.h:8
A visual servoing controller that uses a tracker output as feedback and moves the arm to a goal pose ...
Definition: visual_servoing_controller_arm_connector.h:16