IntroRoboticsLab1/README.md

5.6 KiB

Overview

Each of the following codes allows a specific directive to be sent to a 2D planar robot:

jointControl: Drives the mBot robot to a target location (x, y, theta) using gyroscopic data for precise navigation and orientation tracking.

cartControl: Drives the mBot robot to a target location (x, y, theta) using gyroscopic data for precise navigation and orientation tracking.

testKinematics: Retrieves and prints real-time X, Y, and Z angles from the gyro sensor, enabling orientation monitoring.

linearControl: Implements basic movement patterns such as moving forward, backward, and turning left or right for foundational motion control.

drawImage: Simulates Roomba-like behavior by integrating ultrasonic sensors for obstacle detection and avoidance during autonomous navigation.

linearControlFurther: Implements line-following behavior using a line-finder module to detect and respond to black lines on the ground for path tracking.

Repository Structure

jointControl/

  • @file jointControl.cpp
  • @author Guillaume Gibert
  • @version -
  • @date 2025/04/13
  • @brief Description : This file was provided by G. Gibert. It allows to test different kinds of kinematics.
  • @functions : - void initRobot(DynamixelHandler& dxlHandler, std::string portName, float protocol, int baudRate) - void closeRobot(DynamixelHandler& dxlHandler) - int main()

cartControl/

  • @file cartControl.cpp
  • @author Charles STELANDRE
  • @version V1
  • @date 2025/04/13
  • @brief Description : This file is a variant from jointControl, adapting cartesian Coordinates translation.
  • @functions :
  • @ - void initRobot(DynamixelHandler& dxlHandler, std::string portName, float protocol, int baudRate) - void closeRobot(DynamixelHandler& dxlHandler) - int main(int argc, char** argv)
  • Input:
    • L1 : Length of the first link (cm)
    • L2 : Length of the second link (cm)
    • x : x-component of target position (cm)
    • y : y-component of target position (cm)
  • Output:
    • Displacement of the robot using cartesian coordinates.

testKinematics/

  • @file testKinematics.cpp
  • @author Guillaume Gibert
  • @version -
  • @date 2025/04/13
  • @brief Description : This file was provided by G. Gibert. It allows to test different kinds of kinematics.
  • @functions : - bool testFK(float q1, float q2, float L1, float L2, std::vector expectedEndEffectorPosition, float errorThreshold) - bool testIK(float x, float y, float L1, float L2, std::vector expectedJointValues, float errorThreshold) - int main()

linearControl/

  • @file linearControl.cpp
  • @author Guillaume Gibert
  • @version -
  • @date 2025/04/13
  • @brief Description : This file was provided by G. Gibert. It allows to use a proportionally controlled system to join two points in a linear trajectory.
  • @functions :
  • @ - void initRobot(DynamixelHandler& dxlHandler, std::string portName, float protocol, int baudRate) - void closeRobot(DynamixelHandler& dxlHandler) - int main(int argc, char** argv)
  • Input:
    • L1 : Length of the first link (cm)
    • L2 : Length of the second link (cm)
    • x : x-component of target position (cm)
    • y : y-component of target position (cm)
  • Output:
    • Displacement of the robot using cartesian coordinates.

drawImage/

  • @file drawImage.cpp
  • @author Guillaume Gibert
  • @version -
  • @date 2025/04/13
  • @brief Description : This file was provided by G. Gibert. It allows to use image processing to draw an image after converting it to correct dimensions.
  • @functions :
  • @ - void initRobot(DynamixelHandler& dxlHandler, std::string portName, float protocol, int baudRate) - void closeRobot(DynamixelHandler& dxlHandler) - int main(int argc, char** argv)
  • Input:
    • L1 : Length of the first link (cm)
    • L2 : Length of the second link (cm)
    • image : directory of an image to use for image drawing

linearControlFurther/

  • @file linearControl.cpp
  • @author Guillaume Gibert
  • @version -
  • @date 2025/04/13
  • @brief Description : This file was provided by G. Gibert. It allows to use a proportionally controlled system to join two points in a linear trajectory.
  • @functions :
  •   - void initRobot(DynamixelHandler& dxlHandler, std::string portName, float protocol, int baudRate)
      - void closeRobot(DynamixelHandler& dxlHandler)
      - int main(int argc, char** argv)
    
  • Input:
    • L1 : Length of the first link (cm)
    • L2 : Length of the second link (cm)
    • x : x-component of target position (cm)
    • y : y-component of target position (cm)

README.md

Documentation for the repository.

.DS_Store

System file (can be ignored or removed from the repository).

Requirements

Hardware: mBot robot kit

Software: Arduino IDE

Libraries: Ensure required libraries (e.g., MeMCore.h) are installed in Arduino IDE.

Installation

Clone this repository:

git clone https://gitarero.ecam.fr/charles.stelandre/IntroRoboticsLab2.git

Open Arduino IDE and navigate to the folder containing the .ino file you want to use.

Install any necessary libraries via Arduino Library Manager.

Upload the code to your mBot using a USB connection.

Usage

Navigate to the folder corresponding to the desired functionality (e.g., gyro/).

Open the .ino file in Arduino IDE.

Follow any instructions provided in the comments within the code to execute experiments.