1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Cobot Help and Discussion Center
  4. KUKA LBR IIWA
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

Changing velocity via process data in the background task.

  • uc2kah
  • September 25, 2018 at 5:01 PM
  • Thread is Resolved
  • uc2kah
    Trophies
    3
    Posts
    4
    • September 25, 2018 at 5:01 PM
    • #1

    Hi, everyone!

    I want to try changing the speed of one exact move with the process data.
    But when you change speed in process data it only changes after application is restarted.
    I decided to change it with the background task, so velocity variable in application is overrided in “real time”.
    Code has no mistakes and compilates, but after getting to the movement I control via process data it says that value should be between 0 and 1. So the process data cannot transfer the value through the background task to application. In debug mode it always stays 0.0. Maybe someone had an experience in this question and could help me.
    Thank you in advance!

  • ddt
    Trophies
    3
    Posts
    14
    • September 25, 2018 at 5:03 PM
    • #2

    Can you give the code?

    Sent from my Mi A1 using Tapatalk

  • uc2kah
    Trophies
    3
    Posts
    4
    • September 25, 2018 at 5:39 PM
    • #3
    Quote

    public class BackgroundTask extends RoboticsAPICyclicBackgroundTask {
    private Controller cabinet;
    private GripperSkills gripper;
    private double ptpVelocity;
    private BlueGearEugene bgEugene;

    public void initialize() {
    cabinet = getController("KUKA_Sunrise_Cabinet_1");
    initializeCyclic(0, 500, TimeUnit.MILLISECONDS,
    CycleBehavior.BestEffort);
    bgEugene = new BlueGearEugene();
    gripper = new GripperSkills(cabinet);
    keyExample();
    }

    public void runCyclic() {
    ptpVelocity= getApplicationData().getProcessData("ptpVelocity").getValue(); // Gets data from process data
    bgEugene.getApplicationControl().setApplicationOverride(ptpVelocity); // Sets this data to main application
    }

    Display More

    This is the part of code of main application.

    Quote

    @Override
    public void initialize() {
    cabinet = getController("KUKA_Sunrise_Cabinet_1");
    iiwa = (LBR) getDevice(cabinet, "LBR_iiwa_7_R800_1");
    world = World.Current.getRootFrame();
    gripper = new GripperSkills(cabinet);
    gripperTool = getApplicationData().createFromTemplate("Gripper");
    gripperTool.attachTo(iiwa.getFlange());
    bgTask = new BackgroundTask();
    }

    @Override
    public void run() {
    ptpVelocity = bgTask.getPtpVelocity();
    iiwa.move(ptpHome().setJointVelocityRel(ptpVelocity));
    iiwa.move(ptp(getApplicationData().getFrame("/BlueGear/StartPoint"))
    .setJointVelocityRel(0.3));

    Display More
  • NullReference
    Trophies
    3
    Posts
    93
    • September 25, 2018 at 9:27 PM
    • #4

    Any changes made to process data are reflected directly in the next access, process data is just an XML file that the framework uses for storing data across sessions. You do not need to restart the application for the changes to take effect. You only have to read the process data before parameterizing the motion.

    Your background task may compile but I think it will produce a runtime error because KUKA doesn't allow the application control class to be used within the context of a background task. When you run your app check the smartpendant, if your background task has a red stop icon next to it then it is producing a runtime error.

    Code
    ptpVelocity = bgTask.getPtpVelocity();


    Where is this method coming from, I can't see it in the background task?

    Why are you controlling the application override from the process data? just press the +/- button to control the override.

    If I understood your question correctly then this should be the solution

    Code
    public class testApp extends RoboticsAPIApplication {
    	@Inject
    	@Named("ToolTemplate")
    	Tool myTool;
    
    	@Override
    	public void initialize() {
    	}
    
    	@Override
    	public void run() {
    
    
    		double ptpVelocity =  getApplicationData().getProcessData("YOUR PROCESS DATA").getValue();
    		myTool.move(ptpHome().setJointVelocityRel(ptpVelocity));
    
    	}
    }
    Display More

    You must read the process before executing the motion like above.

  • uc2kah
    Trophies
    3
    Posts
    4
    • September 26, 2018 at 9:08 AM
    • #5

    Thank you, I get what u told about. That is good idea, but we found a better way to do it.

    You just need to use static variable.

    This is background task:

    Quote

    public class BackgroundTask extends RoboticsAPICyclicBackgroundTask {
    private Controller cabinet;
    private GripperSkills gripper;
    private static double ptpVelocity;
    private BlueGearEugene bgEugene;
    public void initialize() {
    cabinet = getController("KUKA_Sunrise_Cabinet_1");
    initializeCyclic(0, 500, TimeUnit.MILLISECONDS,
    CycleBehavior.BestEffort);
    bgEugene = new BlueGearEugene();
    gripper = new GripperSkills(cabinet);
    keyExample();
    }

    public void runCyclic() {
    ptpVelocity= getApplicationData().getProcessData("ptpVelocity").getValue();
    }
    public static double getPtpVelocity() {
    return ptpVelocity;
    }

    Display More


    This is the main applicayion:

    Quote


    public class BlueGearEugene extends RoboticsAPIApplication {
    private Controller cabinet;
    private LBR iiwa;
    private ObjectFrame world;
    private boolean status;
    private GripperSkills gripper;
    private Tool gripperTool;
    private BackgroundTask bgTask;

    @Override
    public void initialize() {
    cabinet = getController("KUKA_Sunrise_Cabinet_1");
    iiwa = (LBR) getDevice(cabinet, "LBR_iiwa_7_R800_1");
    world = World.Current.getRootFrame();
    gripper = new GripperSkills(cabinet);
    gripperTool = getApplicationData().createFromTemplate("Gripper");
    gripperTool.attachTo(iiwa.getFlange());
    }

    @Override
    public void run() {
    iiwa.move(ptpHome().setJointVelocityRel(0.2));
    iiwa.move(ptp(getApplicationData().getFrame("/BlueGear/StartPoint"))
    .setJointVelocityRel(0.3));
    getLogger().info("Getting started in 3...");
    ThreadUtil.milliSleep(1000);
    getLogger().info("Getting started in 2...");
    ThreadUtil.milliSleep(1000);
    getLogger().info("Getting started in 1...");
    ThreadUtil.milliSleep(1000);
    getLogger().info("Executing");
    dialogWindow();
    iiwa.move(ptpHome());
    }

    public void showGear() {
    if (gearStatusCheck()) {
    iiwa.move(ptp(getApplicationData().getFrame("/BlueGear/ShowPoint_1"))
    .setJointVelocityRel(BackgroundTask.getPtpVelocity()));
    iiwa.move(ptp(getApplicationData().getFrame("/BlueGear/ShowPoint_2"))
    .setJointVelocityRel(BackgroundTask.getPtpVelocity()));
    iiwa.move(ptp(getApplicationData().getFrame("/BlueGear/ShowPoint_3"))
    .setJointVelocityRel(BackgroundTask.getPtpVelocity()));
    iiwa.move(ptp(getApplicationData().getFrame("/BlueGear/ShowPoint_4"))
    .setJointVelocityRel(BackgroundTask.getPtpVelocity()));
    ThreadUtil.milliSleep(250);
    }
    }

    Display More
  • NullReference
    Trophies
    3
    Posts
    93
    • September 26, 2018 at 8:55 PM
    • #6
    Quote from uc2kah


    Thank you, I get what u told about. That is good idea, but we found a better way to do it.

    You just need to use static variable.

    This is background task:


    This is the main applicayion:

    Hmmm, this entire background task can be replaced with this method

    Code
    public double getPTPVelocity(){
         return getApplicationData().getProcessData("ptpVelocity").getValue();
    }

    I really don't see why a background task is needed for this.

  • razzo
    Reactions Received
    3
    Trophies
    3
    Posts
    133
    • September 26, 2018 at 9:18 PM
    • #7

    What do you think about to register a listener on the process data?

    Code
    getApplicationData().getProcessData("ptpVelocity ").addProcessDataListener(new IProcessDataListener() {
    
    			@Override
    			public void onProcessDataValueChanged(IProcessData arg0) {
    				double ptpVelocity = arg0.getValue();
    				getApplicationControl().setApplicationOverride(ptpVelocity);
    			}
    		});
  • Seulki
    Reactions Received
    8
    Trophies
    3
    Posts
    84
    • September 27, 2018 at 5:29 AM
    • #8

    Just for your information,
    Motion gets parameter when it starts, and you can't change it in realtime once it is taken into runtime.
    Meaning you need to finish at least one motion to get your changed value effective.

    if you got a loop on your motions, I think you can simplify your code with NullReference's code. Just like refreshing on Windows UI.

    Or, since your background will never stop using resources which is also being accessed by your own application,
    instead, it might be better for you to do the same on a thread inside of your application only while the application is running. Interrupt it on dispose().

  • NullReference
    Trophies
    3
    Posts
    93
    • September 30, 2018 at 6:39 PM
    • #9
    Quote from Seulki


    Just for your information,
    Motion gets parameter when it starts, and you can't change it in realtime once it is taken into runtime.

    There is an option that can be installed to control velocity of all motions regardless of the execution state. It's called enhanced velocity controller and requires an option package to be installed, probably have to pay for it though.

  • Beginner
    Trophies
    3
    Posts
    17
    • August 21, 2019 at 5:38 PM
    • #10

    is It possible to get the current Velocity of an iiwa via backgroundTask?

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download