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

Set general acceleration on Program events window

#1
Working with programs (.nc), I always need to 'Show Instructions' and change ACC/DEC in one of the set speed instructions.
I would _VERY_ much like to have a option on the 'Program Event' window where I can set this together with the 'Rounding' setting.
I'll also report the bug where motoman yaskawa robots do not support setting ACC/DEC _AND_ PL on the same line. You can only have one of them, acc/dec or PL.
#2
I would recommend you to create a custom script or add-in to change the set speed instruction to specify the acceleration settings. This could be as simple as this:
Code:
from robodk.robolink import *  # API to communicate with RoboDK
import json

# Start the RoboDK API
RDK = Robolink()

# Ask the user to select a program:
prog = RDK.ItemUserPick("Select a Program to modify", ITEM_TYPE_PROGRAM)
if not prog.Valid():
    print("Operation cancelled or no programs available")
    quit()

# Ask the user to enter a function call that will be added after each movement:
print("Program selected: " + prog.Name())

# Iterate for all instructions (index start is 0, you can also use -1 for the last instruction)
ins_count = prog.InstructionCount()
for ins_id in range(ins_count):
    # Get specific data related to an instruction
    # This operation always retuns a dict (json)
    instruction_dict = prog.setParam(ins_id)

    # Print instruction data
    #indented_values = json.dumps(instruction_dict, indent=4)
    print("\nInstruction: " + str(ins_id))
    print(instruction_dict)
    # {'Accel': 3000, 'AccelSet': 0, 'JointAccel': 800, 'JointAccelSet': 0, 'JointSpeed': 500, 'JointSpeedSet': 0, 'Name': 'Set speed (100.0 mm/s)', 'Speed': 100, 'SpeedSet': 1, 'Type': 2}

    # Note: The type is unique for each instruction and can't be changed.
    #    However, setting the Type value to -1 will delete the instruction (same as InstructionDelete())
    if instruction_dict['Type'] == INS_TYPE_CHANGESPEED:
        # Set accelerations:
        newvalues = {}
        # Set joint acceleration:
        newvalues['JointAccelSet'] = 1
        newvalues['JointAccel'] = 50

        # Set linear acceleration:
        newvalues['AccelSet'] = 1
        newvalues['Accel'] = 40       

        # Update instruction data
        prog.setParam(ins_id, newvalues)
        break

This is based on this example:
https://robodk.com/doc/en/PythonAPI/exam...structions
In short, each instruction can be represented as a dictionary with custom parameters.

Thank you for letting us know about the bug. We'll fix this with the next update.
#3
Thanks for the script! worked perfect
#4
Great, thank you for your feedback.
  




Users browsing this thread:
1 Guest(s)