# Overview Each of the following codes allows a specific directive to be sent to a 2D planar robot: **[jointControl](#jointControl)**: Drives the robot using joint values. **[cartControl](#cartControl)**: Drives the robot using cartesian values. **[testKinematics](#testKinematics)**: Tests each kinematic algorithm and makes sure they are at the expected value. **[linearControl](#linearControl)**: Drives the robot using cartesian values in a linear trajectory. **[drawImage](#drawImage)**: Draws an input image. **[linearControlFurther](#linearControlFurther)**: Improvement of the linear control which checks for the determinant of the Jacobian to be valid. # 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. # Requirements Hardware: Ergo Poppy Jr. Software: C++ Programming Libraries: Ensure required libraries (Dynamixel SDK - DynamixelHandler.h) # Installation Clone this repository: git clone https://gitarero.ecam.fr/charles.stelandre/IntroRoboticsLab1.git Open a text editor and navigate to the folder containing the .cpp 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 your installation directory. Make the file using ``` make ``` Navigate to the bin folder. Execute the desired file in the command line/ Follow any instructions provided in the comments within the code to execute experiments.