Skip to content

suyash-web/mycobot-line-follower

Repository files navigation

MyCobot Pro 600 – Curved Path Planning and Kinematics (MATLAB)

This repository contains MATLAB scripts (and optional Python helpers) to enable the MyCobot Pro 600 robotic arm to follow a curved path detected from an image.
It integrates computer vision, coordinate mapping, and kinematic control with optional Simulink models for simulation.


🧩 Files

File Description
cobotLineFollower.m Main function mycobot_ik(image_path) — extracts a curve from an image, samples waypoints, maps them to robot coordinates, and computes joint angles via IK. Includes local helpers for skeleton-path finding and interpolation.
imageee.m Script version of the image ➜ path ➜ waypoint pipeline (exploratory/notebook-style).
angle.m Utility that formats and displays jointAngles_all over a simple time vector.
robott.m Loads tocheck.urdf, sets a configuration, and visualizes the robot in MATLAB.
Rigiftreedof.m Builds a multi‑DOF rigidBodyTree (supporting simulation/IK).
Forward.slx, inverse.slx, rigidtree.slx Simulink models for FK/IK and rigid-body structure (optional).
tocheck.urdf Robot model (URDF) used by robott.m.
Forward.py (Optional) Companion Python script, if you prefer prototyping parts of the pipeline in Python.

⚙️ Requirements

  • MATLAB R2023a or later
  • Image Processing Toolbox
  • Robotics System Toolbox
  • Simscape Multibody Toolbox (for Simulink models)

🚀 Quick Start (MATLAB)

  1. Place an input image (black curve on white background) at, for example: images/s11.jpeg.
  2. From MATLAB, run:
    jointAngles_all = mycobot_ik('images/s11.jpeg');   % in cobotLineFollower.m
  3. (Optional) Visualize or simulate:
    robott                   % visualize the URDF model
    open('Forward.slx');     % or open('inverse.slx');

Output: jointAngles_all (N×6) containing joint solutions for sampled waypoints along the curve.


🔢 How it Works

  • Image ➜ Path: Thresholding → morphology → largest component crop → skeletonization → endpoints → BFS to trace a single path.
  • Sampling: Evenly samples points along the traced skeleton length.
  • Mapping: Converts pixels to millimeters using a scale factor and remaps to the robot frame.
  • IK: Builds a rigidBodyTree (modified DH, MDH transforms) and solves for each waypoint using inverseKinematics with a fixed pose orientation.

🧪 Example Snippets

Call the pipeline and inspect angles:

jointAngles_all = mycobot_ik('images/s11.jpeg');
disp(jointAngles_all);

Use the visualization helper:

robott

Simulink (optional):

open('rigidtree.slx');  % structure
open('Forward.slx');    % forward kinematics
open('inverse.slx');    % inverse kinematics

🛠 Troubleshooting

  • “Fewer than 2 endpoints found”: Adjust thresholdValue or lighting/contrast in the input image.
  • “No path found between endpoints”: Ensure a single continuous dark curve; reduce noise with larger morphology (strel('disk', …)).
  • Unstable IK: Tweak initial guess in cobotLineFollower.m or reduce waypoint spacing.

📜 License

This repository is intended for educational and research use.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors