๐ค Manipulation Basics
Robotic manipulation is the art and engineering of controlling an arm and gripper to interact with the physical world.
In your project, manipulation allows your robot to pick up, transport, and drop objects with the MyCobot armโenabling true autonomy.
๐ฆพ Manipulation Fundamentalsโ
Manipulation combines three key components:
- Perception: Detect object pose using sensors/cameras
- Planning: Calculate motions for reaching, grasping, and moving
- Control: Send joint or Cartesian commands to the arm and gripper
Key Conceptsโ
| Concept | Description | Example |
|---|---|---|
| Forward Kinematics | Joint angles โ end-effector pose | "If joints are [30ยฐ, 45ยฐ, 60ยฐ], where is the gripper?" |
| Inverse Kinematics | End-effector pose โ joint angles | "To reach (x, y, z), what joint angles needed?" |
| Workspace | Volume the arm can reach | Spherical region around robot base |
| Singularities | Arm configurations to avoid | Fully extended or folded positions |
๐ฆฟ Arm Control Strategiesโ
In your LIMO + MyCobot project, control happens at several levels:
- Joint Control
- Pose Control
- Pick-and-Place Sequences
Move each joint to a target angle
# Example joint control
joint_angles = [0.0, -90.0, 45.0, 0.0, 45.0, 0.0] # degrees
mycobot.send_angles(joint_angles, speed=50)
Pros:
- โ Direct hardware control
- โ Fast execution
- โ Predictable motion
Cons:
- โ Requires manual calculation
- โ Hard to visualize end result
Move the end effector (gripper) to a 3D pose
# Example Cartesian control
target_pose = [150, 100, 200, 0, 0, 0] # [x, y, z, rx, ry, rz]
mycobot.send_coords(target_pose, speed=50, mode=0)
Pros:
- โ Intuitive positioning
- โ Direct spatial control
- โ Easy to visualize
Cons:
- โ May hit singularities
- โ Slower computation
Pre-programmed or dynamic sequences
# Example pick sequence
def pick_object(object_pose):
# 1. Move to pre-grasp pose (safe approach)
pre_grasp = [object_pose[0], object_pose[1], object_pose[2] + 50, 0, 0, 0]
mycobot.send_coords(pre_grasp, speed=30)
# 2. Open gripper
mycobot.set_gripper_state(0, speed=70) # 0 = open
# 3. Move to grasp pose
mycobot.send_coords(object_pose, speed=20)
# 4. Close gripper
mycobot.set_gripper_state(1, speed=70) # 1 = close
# 5. Lift object
lift_pose = [object_pose[0], object_pose[1], object_pose[2] + 100, 0, 0, 0]
mycobot.send_coords(lift_pose, speed=30)
Use WiFi connection for MyCobot for seamless controlโyour launch system auto-detects IP address for wireless operation.
โ Gripper Operationsโ
The gripper is the "hand" of your robot, essential for object interaction:
Basic Gripper Commandsโ
# Open gripper (prepare for pickup)
mycobot.set_gripper_state(0, speed=70)
# Close gripper (grasp object)
mycobot.set_gripper_state(1, speed=70)
# Partial grip (delicate objects)
mycobot.set_gripper_value(500, speed=70) # 0-1000 range
Gripper Control Strategiesโ
| Strategy | Use Case | Example |
|---|---|---|
| Force Control | Fragile objects | Eggs, glass, electronics |
| Position Control | Standard objects | Boxes, tools, bottles |
| Adaptive Grip | Unknown objects | Variable size/shape items |
Gripper Feedbackโ
# Check if gripper is holding something
def is_gripping():
current_value = mycobot.get_gripper_value()
return current_value > 100 # Threshold for "holding"
# Verify successful grasp
def verify_grasp():
if is_gripping():
print("โ
Object grasped successfully")
return True
else:
print("โ Grasp failed - object not detected")
return False
๐ Pick and Place Workflowโ
- Complete Sequence
- Visual Workflow
- Implementation Example
Full Pick and Place Operationโ
- Navigate to object (using waypoint navigation or real-time detection)
- Object detection determines precise 3D pose of target
- Move arm to pre-grasp pose (safe position above target)
- Open gripper (prepare for pickup)
- Move down to grasp pose (precise positioning)
- Close gripper (secure object)
- Lift object (move to safe transport pose)
- Navigate to drop location (mobile base movement)
- Move arm to drop pose (position over target)
- Open gripper (release object)
- Return arm to home position (safe storage pose)
class PickAndPlaceController:
def __init__(self):
self.mycobot = MyCobot('/dev/ttyUSB0', 115200) # or WiFi
self.navigator = NavigationController()
self.detector = ObjectDetector()
def execute_pick_and_place(self, object_type, drop_location):
try:
# Phase 1: Navigate and detect
object_pose = self.find_object(object_type)
if not object_pose:
return False, "Object not found"
# Phase 2: Pick operation
success = self.pick_object(object_pose)
if not success:
return False, "Pick operation failed"
# Phase 3: Transport and drop
self.navigator.go_to_pose(drop_location)
self.drop_object()
return True, "Pick and place completed successfully"
except Exception as e:
self.emergency_stop()
return False, f"Error: {str(e)}"
def pick_object(self, object_pose):
# Safety pre-grasp approach
pre_grasp = [object_pose.x, object_pose.y, object_pose.z + 0.05, 0, 0, 0]
self.mycobot.send_coords(pre_grasp, speed=30)
time.sleep(2)
# Open gripper
self.mycobot.set_gripper_state(0, speed=70)
time.sleep(1)
# Move to grasp pose
grasp_pose = [object_pose.x, object_pose.y, object_pose.z, 0, 0, 0]
self.mycobot.send_coords(grasp_pose, speed=20)
time.sleep(2)
# Close gripper
self.mycobot.set_gripper_state(1, speed=70)
time.sleep(1)
# Verify grasp and lift
if self.verify_grasp():
lift_pose = [object_pose.x, object_pose.y, object_pose.z + 0.1, 0, 0, 0]
self.mycobot.send_coords(lift_pose, speed=30)
return True
else:
return False
๐ Integration with System Componentsโ
How Manipulation Fits Inโ
Node Communicationโ
| Node | Publishes | Subscribes | Services |
|---|---|---|---|
| Pick Node | /arm/status | /detected_objects | /pick_object |
| Drop Node | /drop/status | /target_location | /drop_object |
| Mission Manager | /mission/status | /arm/status, /nav/status | /start_mission |
๐ ๏ธ Configuration and Calibrationโ
Arm Workspace Definitionโ
# MyCobot 280 workspace limits
WORKSPACE_LIMITS = {
'x_min': -280, 'x_max': 280, # mm
'y_min': -280, 'y_max': 280, # mm
'z_min': -131, 'z_max': 412, # mm
'reach_radius': 280 # mm
}
def is_pose_reachable(target_pose):
distance = math.sqrt(target_pose.x**2 + target_pose.y**2)
return (WORKSPACE_LIMITS['x_min'] <= target_pose.x <= WORKSPACE_LIMITS['x_max'] and
WORKSPACE_LIMITS['y_min'] <= target_pose.y <= WORKSPACE_LIMITS['y_max'] and
WORKSPACE_LIMITS['z_min'] <= target_pose.z <= WORKSPACE_LIMITS['z_max'] and
distance <= WORKSPACE_LIMITS['reach_radius'])
Safety Parametersโ
# manipulation_config.yaml
manipulation:
safety:
max_speed: 50 # 0-100 scale
approach_speed: 20 # Slower for precision
emergency_stop: true # Enable e-stop
timeouts:
move_timeout: 10.0 # seconds
grasp_timeout: 3.0 # seconds
retry_policy:
max_attempts: 3
retry_delay: 1.0 # seconds
๐ก Best Practices & Troubleshootingโ
Safety Guidelinesโ
- Always move to pre-grasp poses before attempting pickup
- Use timeouts and feedback to handle failures
- Test sequences in simulation or with arm "in the air" first
- Ensure arm is at home position before/after sessions
Common Issues & Solutionsโ
๐ง Arm Won't Move
Possible causes:
- Power/connection issues
- Joint limits exceeded
- Emergency stop activated
Solutions:
# Check connection
if mycobot.is_controller_connected():
print("โ
Controller connected")
else:
print("โ Connection failed")
# Reset arm position
mycobot.send_angles([0, 0, 0, 0, 0, 0], speed=30)
# Clear any error states
mycobot.release_all_servos()
time.sleep(1)
mycobot.power_on()
๐ค Grasp Failures
Common causes:
- Object too small/large for gripper
- Incorrect approach angle
- Object slipping during pickup
Improvements:
# Adaptive grasp strategy
def adaptive_grasp(object_size):
if object_size < 20: # Small objects
gripper_value = 200
approach_speed = 10
elif object_size > 50: # Large objects
gripper_value = 800
approach_speed = 30
else: # Medium objects
gripper_value = 500
approach_speed = 20
mycobot.set_gripper_value(gripper_value, speed=70)
โก Performance Optimization
Speed up operations:
- Pre-plan common poses for faster execution
- Use joint space for non-critical movements
- Optimize gripper timing based on object type
- Parallel processing where safe (navigation + arm planning)
# Pre-defined poses for efficiency
COMMON_POSES = {
'home': [0, 0, 0, 0, 0, 0],
'ready': [0, -45, 45, 0, 0, 0],
'scan': [0, -30, 30, 0, -60, 0]
}
def quick_move_to_pose(pose_name):
if pose_name in COMMON_POSES:
mycobot.send_angles(COMMON_POSES[pose_name], speed=50)
else:
print(f"Unknown pose: {pose_name}")
๐ฏ Advanced Manipulation Featuresโ
Vision-Guided Graspingโ
def vision_guided_pick(self, object_class):
# Get object pose from camera
detection = self.object_detector.detect(object_class)
if detection:
# Convert camera coordinates to arm coordinates
arm_pose = self.transform_pose(detection.pose)
# Adjust for object orientation
grasp_angle = self.calculate_grasp_angle(detection.orientation)
arm_pose.rotation = grasp_angle
return self.pick_object(arm_pose)
return False
Collaborative Operationโ
class CollaborativeManipulation:
def __init__(self):
self.human_detector = HumanDetector()
self.safety_zone = SafetyZone(radius=0.5) # 50cm safety buffer
def safe_manipulation(self, target_pose):
if self.human_detector.human_in_workspace():
self.pause_and_wait()
else:
self.execute_manipulation(target_pose)
๐ Learn Moreโ
- MyCobot Official Documentation
- ROS2 Manipulation Tutorials
- MoveIt2 Motion Planning
- Robotic Grasping Fundamentals
๐ฏ Next Stepsโ
Now that you understand manipulation basics:
- Implementation: Pick & Drop Nodes
- Integration: System Integration
- Advanced: Custom Object Detection
- Troubleshooting: Manipulation Issues