Cancel
Showing results for 
Search instead for 
Did you mean: 

Robot not moving with simulation player

Pioneer
Pioneer

Hey,

 

I try to write a program that simulates an operation multiple times while moving the robot between the runs to generate a matrix. The result should be a collection of the jointvalues at every time step during the simulation so that I can plot them over the time. The following pseudocode shows my structure.

 

while (current_time <= simulation_time)

{

player.JumpSimulationToTime(current_time, simVisible, source);

read jointvalues (robot.joints[0..5].CurrentValue) and store them into collections;

current_time += time_interval;

}

 

The first position of the robot is working just fine. But after shifting the robot to another position, the player does not move the robot anymore (when simVisible is true) and therefore the jointvalues are always the same (equal to the start value).

Why isn't it working even though the first run does exactly what I want?

Hope someone can help.

 

Best regards,

Felix

10 REPLIES

Re: Robot not moving with simulation player

Legend
Legend

Hello @FS_ZeMA

 

Do you have more information of your code?

 

The following test I've run below worked fined here, check if it helps you:

 

private void button_Click(object sender, EventArgs e)
        {
            TxSimulationPlayer player = new TxSimulationPlayer();
            player.SetProgram(_embSim.RobProgram); // _embSim is a custom class to store simulation objects

            double currtime = 0.0;
            double interval = 0.2;

            while (currtime < 10)
            {
                player.JumpSimulationToTime(currtime, true, TxSimulationPlayerSource.CurrentPlayer);
                currtime += interval;
            }
}

But there's a lot more to consider that is not above (and I'm not sure how you're handling), for example:

 

* Be sure to reset simulation when you end it (player.Rewind()), otherwise you might have problems (the time spent from moving the robot from last simulation time position to initial time will be considered on the next simulation) . 

* I don't know how did you compute your simulation time, but I prefer to use the endedforward event from the TxSimulationPlayer object. 

 

Regards

 

Re: Robot not moving with simulation player

Pioneer
Pioneer

Hello @FredCastro,

 

thanks for your reply.

The operation time is a property of the operation object. The thing is the program worked just fine for months. After I added something that has nothing to do with this computation it started to fail. I will try to reset the simulation and to use the end event of the player and tell you about the result.

 

Thanks

Regards

Re: Robot not moving with simulation player

Pioneer
Pioneer

Hello @FredCastro,

 

unfortunately nothing has changed. I'll show you more of my code.

 

while (current_time < operation.duration)

{

simulation.JumpSimulationToTime(current_time, false, TxSimulationPlayerSource.CurrentPlayer);

Store Joint values;

add time interval to current_time;

}

 

current_time = 0;

rewind simulation;

Move Robot to different position;

set Robot tcp to first location;

 

while (current_time < operation.duration)

...

 

This Structure is repeated for every Position (e.g. 3x3 Square with 200mm distance in each direction, so 9 different positions of the robot). First I simulate the position the robot is standing based on where I put him in process simulate. This simulation is working. I have 6 arrays with the corresponding jointvalues over time, respectively. Then I start moving the robot left and right, back and forth until the remaining 8 positions are simulated. The arrays after these 8 simulations always show one value in each and every entry although the values should of course be different.

 

Do you have another idea what the problem could be? Apparently, something after the first position leads to the error.

 

Thanks,

Regards

Re: Robot not moving with simulation player

Legend
Legend

Hello @FS_ZeMA

 

So, in your old implementation, did you have the moving robot or is this something new?

 

Can you confirm if the robot is really moving to a new position (can you track its position?) and if your part (and assigned locations) are not attached to the moving robot (this would mean your 9 arrays would have the same values) ?

 

Regards

Re: Robot not moving with simulation player

Pioneer
Pioneer

Hello @FredCastro

 

Yes, I had a moving robot. And now I only have a moving one with the first location.

I can confirm and see that the robot is changing positions.

A gripper is attached which grips a part. That works when I simulate it in PS.

 

Regards

Re: Robot not moving with simulation player

Pioneer
Pioneer
I just noticed the error occurs after I change the robots position. Even when I change it to the exact same position it fails, so it must have something to do with the positioning command.
I use
robot.LocationRelativeToWorkingFrame = "a location";

Re: Robot not moving with simulation player

Legend
Legend

@FS_ZeMA

 

Can you share your full positioning method code?

Re: Robot not moving with simulation player

Pioneer
Pioneer

@FredCastro

 

I calculate the next position and store it to newPosition.

TxTransformation newPosition = new TxTransformation(new TxVector(newX, newY, newZ), TxTranformation.TxTransformationType.Translate);
robot.AbsoluteLocation = newPostition; (I changed it to absolute location to see if this was the problem, but it wasn't)

If I start the program store the current position of the robot in cur_pos and then say

 

robot.AbsoluteLocation = cur_pos;

 

it works for this first position.

But if I say

 

TxTransformation cur_Position = new TxTransformation(new TxVector(cur_X, cur_Y, cur_Z), TxTranformation.TxTransformationType.Translate);

robot.AbsoluteLocation = cur_Position;

 

it does not work.

So the problem seems to be in the creation of the position.

 

EDIT:

After creating a new position all euler rotations of this position are 0. But the initial euler rotations are not equal to 0, so is there a way to only change the translation?

I also tried

robot.Locate(newPosition);

Same error.

 

EDIT 2: Fixed the problem. The location was not reachable although PS told me it was.
Thanks alot for the help @FredCastro Smiley Happy

Re: Robot not moving with simulation player

Legend
Legend

Hello @FS_ZeMA

 

TxTransformation has a lot of overload methods, the way you're creating a new transformation seems not to consider rotation values. But there's a constructor where you pass translation and rotation vector, which I assume will fit better your needs.

 

Regards!