Python Example - Mecademic Python API

Mecademic Python API is a python module designed for Robot products from Mecademic. The module offers tools that give access to all the features of the Mecademic Robots such as MoveLin and MoveJoints. The module can be started from a terminal or a python application and controls the Mecademic Products.

Supported Robots

  • Meca500 R3

Prerequisites

To be able to use the module without unexpected errors, the user must have a copy of python installed on their machine and it is recommended to use python version 3.6 or higher. Python can be installed from its main website (a reboot will be require after the installation to complete the setup).

Getting Started

To download and install the module, please refer to the Github page for step by step instructions.


Program

The RobotController class is used to send the robot commands and read the responses on Port 10000. An example of a script for a Mecademic Robot would be: 

import MecademicRobot
robot = MecademicRobot.RobotController('192.168.0.100')
robot.Connect()
robot.Activate()
robot.Home()
robot.SetBlending(0)
robot.SetJointVel(100)
while True:
robot.MoveJoints(0,0,0,170,115,175)
robot.MoveJoints(0,0,0,-170,-115,-175)
robot.MoveJoints(0,-70,70,0,0,0)
robot.MoveJoints(0,90,-135,0,0,0)
robot.GripperClose()
robot.MoveJoints(0,0,0,0,0,0)
robot.MoveJoints(175,0,0,0,0,0)
robot.MoveJoints(-175,0,0,0,0,0)
robot.MoveJoints(175,0,0,0,0,0)
robot.GripperOpen()
robot.MoveJoints(0,0,0,0,0,0)

This will make the Robot perform a repetitive task until the program is terminated. 


The RobotFeedback class is used for reading the position feedback data and robot status on Port 10001. An example for how to use the RobotFeedback module is as follows:

import MecademicRobot
feedback = MecademicRobot.RobotFeedback('192.168.0.100', '8.1.7')
feedback.Connect()
while(True):
feedback.getData()
print(feedback.joints)
print(feedback.cartesian)


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.