Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

How to use send commands to the robot driver

I'm using a Mitsubishi robot controlled via the RoboDK Python API. I am trying to turn on the servo from the python script and after cycle operation I want to turn off the servo. But cannot achieve this. Please find the attached image that contains my script code and the setup. I am also attaching the script code here. Kindly advise on my wrong steps.
# This macro shows an example to draw a polygon of radius R and n_sides vertices using the RoboDK API for Python
# More information about the RoboDK API here:
from robolink import *    # API to communicate with RoboDK
from robodk   import *      # robodk robotics toolbox
# Connect to the RoboDK API
RDK = Robolink()
robot=RDK.Item('Mitsubishi RV-7FR' )
robot.Connect("") # connect to the robot.
#Use double inverted comma for ip address
#robot.RunInstruction("Servo On",INSTRUCTION_INSERT_CODE)
robot.RunInstruction(" c 1;1;SRVON",INSTRUCTION_INSERT_CODE)
# Retrieve all items and print their names
list_items = RDK.ItemList()
for item in list_items:
home_position = RDK.Item('Home')
Target_position = RDK.Item('Target')
Target_position3 = RDK.Item('Target 3')
loop_count = mbox("enter the loop number",entry = "")
for i in range(int(loop_count)):
    # Set the speed of the
    # robot (for example, 50 mm/s and 20 deg/s)
robot.RunInstruction(" c 1;1;SRVOFF",INSTRUCTION_INSERT_CODE)

Attached Files Thumbnail(s)
You can send custom commands to the driver by using setParam. For example, if you want to turn the servo off of your Mitsubishi robot you can do this:
robot.setParam("Driver", "c 1;1;SRVOFF")
# or
robot.setParam("Driver", "SRVOFF")
Thanks Albert for the reply. I will try it on Monday. By the way, where can I get the RoboDK equivalent for various commands of Mitsubishi or other robots. Because I found that the command syntax to turn off the servo for the said robot is different which is "Servo OFF" not "SRVOFF". "Servo OFF" is according to the Mitsubishi RT toolbox. I am kind of confused regarding this hope you could clarify.
The commands available for each driver are usually displayed in the commands window of the robot connection.

RoboDK can have some predefined commands, such as SRVOFF for Mitsubishi, which will trigger the Mitsubishi code 1;1;SRVOFF. This is the command required by the controller. In short, the "c" letter allows you to pass any supported command by the Mitsubishi robot itself.

Users browsing this thread:
1 Guest(s)