Control Gripper

control_gripper.py

Overview

control_gripper.py is an ActionLib server that commands the TIAGo gripper to open or close. It accepts a boolean goal—True to grip, False to release— and publishes a std_msgs/Bool on the gripper command topic. After a short delay, it reports success or honours any pre-emption/abort requests.

Interfaces (strongly-typed, stateless)

Direction

Topic / Name

Type / Semantics

Publish

/{robot}/cmd_vel/gripper

std_msgs/BoolTrue to close, False to open

Action server

/{robot}/gripper_control

tiago1/GripperControlAction Goal: gripnogrip (bool) Feedback: status (string) Result: success (bool)

Contract

Pre-conditions

  • Action server started before goals arrive.

  • Publisher on /cmd_vel/gripper is available.

Post-conditions

  • On goal reception, publishes exactly one boolean command.

  • After delay, sets Action to succeeded, pre-empted, or aborted.

  • Feedback published once per goal with a brief status.

Invariants

  • Delay duration and command topic are configurable in execute_cb().

  • No persistent state beyond wiring subscribers/publishers.

Tuning knobs

  • actuation_delay = 2.0 seconds – adjust for real hardware response.

class control_gripper.ControlGripperServer[source]

Bases: object

ActionLib server wrapping a boolean gripper command.

Variables

cmd_pubrospy.Publisher

Publishes Bool on /cmd_vel/gripper.

serveractionlib.SimpleActionServer

Serves gripper_control goals.

Workflow

  1. Read robot_number from CLI.

  2. Initialise ROS node <robot>_control_gripper_node.

  3. Advertise /cmd_vel/gripper.

  4. Start SimpleActionServer on /gripper_control.

execute_cb(goal: tiago1.msg.GripperControlAction.Goal) None[source]

Handle a grip/no-grip command.

Parameters:

goal (GripperControlAction.Goal) – goal.gripnogrip == True → close, False → open.