Add waypoints without moving across them


I am tryng to build my application and my goal is to add a set of waypoints in order to save their coordinates but i do not want to move across them (i know that it sounds a bit tricky but i have coded a proper urcap that will do the magic).

The only option that i have found up to now is to insert an IF FALSE statement and add inside a moveNode with the waypoints: by doing in this way i am able to achieve my goal.

This latest option could work but i do not think that it is the best one.

Do you know if i have other options?

That is how I do it, as well. If 1 = 2. :slight_smile:

You could maybe add the waypoints as point features? These can be used as postional variables in the program, as well.

1 Like

So these are the two possibilities.

The product i am implementing will be used commercially.

The main idea is to pass a waypoint list to my function and then the robot will move accordingly to these waypoints.

I have tought that the possibility of using an IF FALSE statement could be visually unpleasing for the customer hence my question.

Which of the two do you think is the best option? Because i am more prone to use the IF FALSE rather then the point features

The If-statement has the advantage of being easier accessible from within the program. But it is visible, as you mention yourself. I would go with this myself, though.

You could also make a subprogram and place the waypoints here? It can be hidden and you would not need an if-statement. Or just a folder which also has the Hide feature, but you would need the If here… :slight_smile:

If a move and a bunch of waypoints are added as children into a custom node the children should not be called if you use the writer.writeChildren() call.
soby leaving this out you jump across all child nodes.

Also kinda of an ugly solution as its resluts in the ilusstion that a move is happening and that you (the user) have some control over it.

I would recommend looking into the customAPI sample for this purpose.

As a solution using this would properly give you the prettiest result.

I was wondering too about the possible implementations of these other two options.

The subProgram option could be good due to the fact that the user could have a specific place where to add a move with some waypoints but due to the structure of a subprogram this will never be executed unless a call is issued.

In this way i could have access to the name of these waypoints.

The folder option, as correctly pointed out by you, still needs the if false statement, otherwise the move instruction will be executed.

EDIT: the structure of my program is the following

-custom instruction 1

  • move p
    – way 1
    – way 2
    – way N
  • custom Instruction 2
  • custom instruction 3

My goal is to have a create a list of the waypoints present inside the moveP .

This list of points should be later passed to custom Instruction 2 .
(idea: list= [way1, way2, wayN])

This list is of variable size due to the fact that the user is free to add how man waypoints he needs.

Do you know how can i get this list of waypoints?

I’m really confused by this question. If you already have a URCAP and you just want to store positional data, without actually moving across them, why don’t you just make an arrayList of Pose variables or store the positions to the datamodel with a button on your Custom Instruction 2. Why do you need a list of waypoints present in your program at all?

What about collecting all of the waypoints in one move command and then simply commenting that command out?
Its just one button you have to press, no if stuff, and the list will automatically collaps, if you comment it out.

HI @sebastian.reindl !

I have already tested this approach and it faces a little problem: if i comment out these points, they are not present inside the script when it is written out, hence i do not have access to the pose of the waypoints that were commented out.

Hi @eric.feldmann |

i know that this sound a bit strange, but i have to perform some calculation based on the point that are given.

As result of these calculation i will then perform a movement in which the waypoints may not be in the same order as the ones that i have captured.

Hence the reason why i need to store and get access to these waypoints without moving across them

Please let me know if i was not clear in my explanation

Oh, I see… You need somthing like a database of waypoints, that you can work with, but the robot should not approach the stuff in the database.

I think then you already have got the best solutions.


That’s what i am trying to achieve!

Unfortunately up to now this was an un discussed topic!

I will let to know which solution is the best in my technical case so that it can help others

What you’re describing is not strange at all. You’re describing the most basic data structure: a list

A database (list) of waypoints is exactly what I’m talking about doing. You don’t need one node per Pose you want to store. You can store any number of Poses inside the installation contribution if you want. You can make an arrayList whose size is dynamic. Click a button to trigger the getRobotMovementPosiiton() or whatever it is, and use its onOK() method to increment the list’s size and store the Pose/Joint Posiitons into the data model with something like:

model.set("STORE_POSITION_" + myPoseList.size(), robotPose)

Just use some iterator to generate a unique string for the model data (in this case using the size of the list itself should guarantee that as you add positions, they are stored uniquely)

You can use a comboBox to display the “database” as a dropdown list of positions, and even include a “Move Here” button, which uses the currently selected index of the dropdown box to pull from the arrayList of poses.

The generateScript() method can then iterate through the arrayList with a simple for() loop and write all the positional information at the top of the script. Being in the installation node, this would be written out once, at the very beginning, essentially making them global variables.

I pulled this straight out of my CAP. Pretend instead of being Set Home position, it was just a generic Set Position button.
Here I have 10 unique Positions stored in the installation. I can access them from any of my other program node contributions if I need, I can even populate the list from the other contributions if I needed to.

1 Like


Thank you for your exhaustive comment!

I have a question related to this topic: suppose to have the same setup of the previous case. I have a main custom instruction 1 inside which i have a movep and two custom instructions.
In this situation, i want my custom instruction 2 to be executed after the movements inside the move p instruction.
This custom instruction 2 will perform some movements base on the previous points inside the move. In order to achieve this, i need to pass a list of poses (the ones inside the move p) to the custom instrutcion 2. (this pose list is dynamic).

custom instruction 1

  • move p
    – way 1
    – way 2
    – way N
  • custom Instruction 2
  • custom instruction 3

The problem with this, i that i cannot find a way in order to build up this array of poses. I had a look at this WaypointNode getPose() example but unfortunately i could not make it work.

Do you have any hints?

You will need to follow that example and use a traverse() function. In the example, the visit is passed a “WaypointNode programNode” so it will only run the code on each node it finds that is of this type. As another example, if you called

public void visit(final URCapProgramNode programNode, final int index, final int depth)

You would be running code for every instance of a URCAP node that you’ve found (ie custom instruction 2, custom instruction 3). You will likely need to call both versions of the visit(). One to operate on the built-in waypoint nodes, calling getPose to build the array of poses, and another using URCapProgramNode to find custom instruction 2, at which point you can store the array into this node. Then you can access this arrayList of poses from that node’s contribution.

1 Like


Thank you!

After a bit of troubles i was actually able to retrieve the pose of the waypoints i was interested in!