I tried to send script and it worked - rostopic pub /ur_hardware_interface/script_command std_msgs/String “data: ‘set_digital_out(2,True)’”
Reference (ROS Driver - Dashboard/RawRequest)
But I found sending script made ROS disconnected.
Is there any way to send script command with ROS still connected?
Robot : UR10 CB3
URCaps : External Control for ROS
There can only be one primary program running on the controller. See URScript via topic cancels robot program on controller · Issue #33 · UniversalRobots/Universal_Robots_ROS_Driver · GitHub for details on how to circumvent this in certain situations.
really thx, I added script secondary option “sec” and it worked without ros disconnected.
sec secondaryProgram(): set_digital_out(1, True) end
Actually, what I was trying to do is sending urscript for Onrobot VG10, not the UR10 robot. I extracted script code from .urp file from teach pendant and send it via python socket communication code $(robot_ip):30002. it worked without secondary option but it cause the ROS disconnection as said in the link you gave.
I tried it again with secondary option like below. However, the urscript for vg10 doesn’t seem to work with script secondary option.
sec secondaryProgram(): ... ...(about 1422 lines for VG10 to grip) ... end
I know, it’s kinda weird to ask here, this forum but Onrobot and Universal Robots are cooperative one another?
So, I’m posting here just in case…
Please see the documentation on secondary programs. Whether your script code will work as a secondary program is highly depending on the actual script code you’re trying to execute.
I imagine that a script of 1422 lines will consume controller time at some point…
Note, that you can also have a program flow on the TP contaiing the nodes for your gripper and then go into external control. Also, control from ROS side can be stopped by calling the hand_back_control service. This will end the external program node on the TP continuing with the next program node in your program tree. You can also have multiple instances of the external_control node inside your program tree.
Also, if you prefer a ROS-centric application flow, you can send a primary script to the robot for execution, which will stop your external_control program from running. You can rerun it by calling the dashboard server’s play service. Stopping the external_control node (e.g. by running another script code) will not terminate the ROS connection to your robot, it will only disable controlling the robot’s motions using ROS. Re-running the program containing the external_control node will bring the ROS driver to a full working state again.
Thank you so much.
yeah… I agree with that point, I’m really afraid to analyze all the script code. it could be a waste of time for now.
I didn’t know about the hand_back_control service. is it same with the dashboard server stop service? I actually tested with the ‘play’ ‘stop’ service before. Thanks for mentioning that!
I really prefer a ROS-centric application flow, even it doesn’t terminate the ROS connection totally.
So I should try hand_back_control service and look for the other methods to operate the VG10.
Everything I was curious about was solved. Thank you again!
No, they are not the same.
stop will terminate the program, while
hand_back_control will only end executing the external_control node. If you have other nodes inside your program tree after the external_control node, they won’t get executed, when calling
stop while being inside the
external_control node. If
hand_back_control is used, the program will continue with the nodes coming after the