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. Industrial Robot Support and Discussion Center
  4. ABB Robot Forum
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

create wobj only if it does not exist

  • cncandi
  • January 6, 2025 at 5:16 PM
  • Thread is Unresolved
  • cncandi
    Trophies
    4
    Posts
    6
    • January 6, 2025 at 5:16 PM
    • #1

    I get error message after second run of program "name of global variables ambiguous - wobjDTR"
    What is reason for that? Maybe because this wobj allready exist? But in that case hoow can I add
    loop to check "does wobj exist" if yes only add values to wobj if not create wobj.

    Code
     PERS wobjdata wobjDTR:=[FALSE,TRUE,"",[[2139.255,-700.863,82.787],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
     PERS wobjdata wobjDTR1:=[FALSE,TRUE,"",[[2783.408,-1005.003,494.999],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
     
     ! GESCHWINDIGKEITEN
     VAR speeddata SlowSpeed := [500, 300, 100, 5];
     VAR speeddata FastSpeed := [500, 300, 200, 100];
  • Lemster68
    Reactions Received
    295
    Trophies
    9
    Posts
    2,454
    Blog Articles
    7
    • January 6, 2025 at 5:29 PM
    • #2

    The code you have posted has unique names for the two workobjects. They are not ambiguous. Is there some loading/unloading of modules going on in the executable code?

  • hermann
    Reactions Received
    404
    Trophies
    9
    Posts
    2,595
    • January 6, 2025 at 6:54 PM
    • #3
    Quote from cncandi

    I get error message after second run of program "name of global variables ambiguous - wobjDTR" ..

    The code you showed can't be run. It only contains declarations, they can't be exectuted. Probably Lemster68 is on the right lane.

  • cncandi
    Trophies
    4
    Posts
    6
    • January 7, 2025 at 5:23 PM
    • #4

    I know that I can't run program. It is only snippet from program head. Is there possibility to add a if--then---else loop to create wobj only if it does not exist. Otherwise change only values.

  • jarm
    Reactions Received
    9
    Trophies
    3
    Posts
    247
    • January 7, 2025 at 7:56 PM
    • #5

    Open your controller in robotstudio and search for wobjDTR:=. Search controller and see if you've declared it elsewhere. just delete the one you don't want.

    1. open the studio after you connect the controller. Put the robot in manual

    2. goto the controller tab and add controller tab and click your controller.

    3. goto the next tab to request write access. acknowledge on pendant

    4 goto rapid tab and click find/replace and choose find

    5. type wobjDTR:= and choose current controller to find all instances of that txt.

    Don't search the the entire declaration because they could be different and it wont see it, and don't search just the name wobjDTR because that will be in every line of code that contains that workobject.

    Include the := That will find all the declarations on the controller. The list will appear in the bottom output screen.

    You can delete the duplicate and hit the tab apply. the error message should disappear.

    If the declarations are different then you may want to copy the one to a notepad before you delete it incase you delete the wrong one.

    cancel write access and carry on

    Edited 2 times, last by jarm (January 7, 2025 at 9:17 PM).

  • hermann
    Reactions Received
    404
    Trophies
    9
    Posts
    2,595
    • January 7, 2025 at 8:19 PM
    • #6

    You can't use "if then else" in declaration part of a module. You only can use it in code section. Only code section can be executed. So it's useless to show only declaration part without the executed code, where the error occurs.

  • Lemster68
    Reactions Received
    295
    Trophies
    9
    Posts
    2,454
    Blog Articles
    7
    • January 7, 2025 at 8:36 PM
    • #7

    If the workobject didn't exist, then you could not execute the program anyway because the ambiguity error would be replaced with a reference error. You need to find where the ambiguous declaration is and then why it is there.

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

Tags

  • wobjdata
  • wobj
  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