Hey, I want to change the speed of my robot based on an input.
Basically I've got a UR10 in a system tied to a light curtain, and I want to drop the speed down to like 15% when somebody breaks the light curtain. Any ideas on how I could do this?
Hey, I want to change the speed of my robot based on an input.
Basically I've got a UR10 in a system tied to a light curtain, and I want to drop the speed down to like 15% when somebody breaks the light curtain. Any ideas on how I could do this?
The easiest way to do this is with a little bit of scripting commands. You can use script to control the speed slider, which will change the speed of the robot, which should get you the kind of behavior you want.
For example:
would change the speed slider to 50% and drop the speed of the robot by half. Just put each line in its own script command, and put this into a Thread that is monitoring the state of your input. There is an example on how to do this on the UR support wiki. Also, don't forget the socket_close() each time you are done changing the speed slider, or your program might act a little weird.
It is also possible that you could use the safety features on the CB3 to get similar behavior (just safety rated). If you set your reduced mode to be 15% of your normal mode operation, wire your light curtain into the configurable inputs, and then set the inputs to 'Trigger Reduced Mode', you should see the same performance (I haven't tried this out, so your mileage may vary.)
Good luck.
Hey, that's great thanks!
How do I get onto the Universal Robots support website? I tried but it wouldn't let me create a login.
Yeah, you have to have a login created for you by UR. It's a little bit of a hassle, but if you talk to your official UR distributor (the person you bought your robot from) they should be able to help you figure it out.
Hey guys,
I'm having some issues with that function. Trying it like the above example, it gives me the error code C204A3 (Something with sudden change in speed, an error which UR implemented just recently... -.-)
On the UR Website you can find an example :http://www.universal-robots.com/how-tos-and-fa…-program-15293/
Here it is stated, that you have to send "set speed" and the speed value seperated.
Now what I want to do is controlling the speed from an external device, so I write everything in C++. This looks like this:
double speedpercentage;
char changespeed1[32];
char changespeed2[24];
char changespeed3[21];
double speed;
std::cout << "\nPlease type a velocity in % (0-100%)" << "\n";
std::cin >> speedpercentage;
speed=speedpercentage/100;
snprintf(changespeed1,32, "socket_send_string(\"set speed\")\n");
snprintf(changespeed2,24, "socket_send_string(%1.1f)\n",speed);
snprintf(changespeed3,21, "socket_send_byte(10)\n");
printf("\nDatapackage to Robot:\n");
printf("%s",changespeed1);
printf("%s",changespeed2);
printf("%s",changespeed3);
for (int i=0;i<1000;i++)
{
Tcp_send(tcp_conn.socketNumber, changespeed1 ,sizeof(changespeed1));
Tcp_send(tcp_conn.socketNumber, changespeed2 ,sizeof(changespeed2));
Tcp_send(tcp_conn.socketNumber, changespeed2 ,sizeof(changespeed3));
}
Display More
But all again, the same error.
without the \n at the end of the command, the robot doesn’t react at all:
snprintf(changespeed1,32, “socket_send_string(\”set speed\”)”);
snprintf(changespeed2,24, “socket_send_string(%1.1f)”,speed);
snprintf(changespeed3,21, “socket_send_byte(10)”);
if the \n is there, we get the same error as mentioned above (C204A3):
snprintf(changespeed1,33, “socket_send_string(\”set speed\”)\n”);
snprintf(changespeed2,25, “socket_send_string(%1.1f)\n”,speed);
snprintf(changespeed3,22, “socket_send_byte(10)\n”);
so i tried this one, in hope of seeing the three lines in the example as one big command but this doesn’t lead to any reaction as well:
snprintf(changespeed1,32, “socket_send_string(\”set speed\”)”);
snprintf(changespeed2,24, “socket_send_string(%1.1f)”,speed);
snprintf(changespeed3,22, “socket_send_byte(10)\n”);
After all that, maybe he wants everything in one line, so here, the examples above written and send in one line, but same result as above:
snprintf(changespeed1,80, “socket_send_string(\”set speed\”)\nsocket_send_string(%1.1f)\nsocket_send_byte(10)\n”,speed);
snprintf(changespeed1,80, “socket_send_string(\”set speed\”)socket_send_string(%1.1f)socket_send_byte(10)\n”,speed);
snprintf(changespeed1,80, “socket_send_string(\”set speed\”)socket_send_string(%1.1f)socket_send_byte(10)”,speed);
Thought maybe he has problems reading the %1.1f Value but the console gives me this when I print it out:
(1.example without \n, 2.example with \n)
QuotePlease type a velocity in % (0-100%)
56Datapackage to Robot:
socket_send_string(“set speed”)socket_send_string(0.6)socket_send_byte(10)
QuotePlease type a velocity in % (0-100%)
56Datapackage to Robot:
socket_send_string(“set speed”)
socket_send_string(0.6)
socket_send_byte(10)
Even when sniffing the Bytestream from eth0 via wireshark it shows the right data.
I'm getting out of options here, and I really don't want to control the robot completly from the external computer (like with moveJ, moveL commands and adjusting the velocity there)
Hope you guys have any ideas?
Regards
Sudden change in TCP speed is probably to avoid the jerk when using a step function to cap the speed.
try gradually lowering the speed to desired value. for example if the speed is at 100% and you want to drop to 50%
try
socket_open("127.0.0.1",30002)
socket_send_line("set speed 0.80")
sleep(0.05)
socket_send_line("set speed 0.65")
sleep(0.05)
socket_send_line("set speed 0.50")
sleep(0.05)
socket_close()
Hopefully this'll get rid of the error. Let me know !!