0
$\begingroup$

Rosanswers logo

I'm working with a system using two UR5 arms being controlled via a pair of ur_modern drivers. I'm trying to implement a joystick button to engage teach mode on the arms, mostly because it's sometimes physically challenging in our setup to manipulate the teach-mode-d arms while holding down the Teach Pendant button.

The URscript API (http://www.sysaxes.com/manuels/scriptmanual_en_3.1.pdf) documents the 'teach_mode()' and 'end_teach_mode()' commands, and I've been trying to make the button work by publishing these commands to the URscript topic that ur_modern creates and listens to. I've had success using other URscript commands through that topic ('movej()', 'speedl()', and 'stop()' in particular), but I haven't been able to get the teach_mode() command to do anything at all.

I've read that there have historically been issues getting the Teach Pendant and ROS-I ur_driver to play well together around teach mode, because they constantly send conflicting messages - is the issue I'm having because the Teach Pendant is constantly telling the robot it's NOT in teach mode until the button on the pendant is depressed? Is there any other solution I might pursue to try to get this to work?

Thanks in advance!

EDIT 11/16/2016:

On gvdhoorn's advice below, looked into the Teach Pendant logs. The log seems to record most commands I send through the ur_modern URscript topic, but does not report anything for the teach_mode() command. Example log output:

// Enabled teach mode using the pendant, then released it:   
URControl C100A1: Robot changed mode: TEACH   
URControl C100A0: Robot changed mode: OK   
// Used URscript topic to send movej(), speedl(), and stop() commands:   
RTMachine Program stopl started   
RTMachine Program stopl started   
RTMachine Program movejstarted   
RTMachine Program stopl started   
RTMachine Program speedl started   
RTMachine Program speedl started   
RTMachine Program speedl started   
RTMachine Program speedl started   
// Sent teach_mode() commands via URscript topic --> no output on log   

Sidenote - the api also lists both teach_mode() and freedrive_mode() commands, and I'm not clear on what the difference between these is... I've tried both though, to the same lack of effect.


Originally posted by conor.mcmahon on ROS Answers with karma: 73 on 2016-11-14

Post score: 0


Original comments

Comment by gvdhoorn on 2016-11-15:
The ur_modern_driver should only upload the controller side of things whenever it needs to execute a trajectory. Can you try and see whether the log tab on the pendant has any info on which programs are running at the time you send teach_mode()?

Comment by gvdhoorn on 2016-11-15:
To test whether there is some clash with ur_modern_driver, use something like ncat to send the URScript command directly. ThomasTimm/ur_modern_driver#73 might also be related.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I have solved this problem. We need a loop to set the teach mode.

       std_msgs::String temp;
        std::string cmd_str;
//        std::string force_mode="force_mode( tool_pose(), [0, 0, 1, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 2, [0.05, 0.05, 0.05, 0.17, 0.17, 0.17])\n";
//        std::string free_drive_mode = "\tfreedrive_mode()\n";

        while(ros::ok()){
            bool last_io_button = io_button_;
            ros::spinOnce();
            if(!last_io_button && io_button_){
                cmd_str = "def myProg():\n";
                cmd_str += "\twhile (True):\n";
                cmd_str += "\t\tfreedrive_mode()\n";
                cmd_str +="\t\tsync()\n";
                cmd_str += "\tend\n";
                cmd_str +="end\n";
                temp.data = cmd_str;
                pub_free_drive_.publish(temp);
            }
            if(last_io_button && !io_button_){
                cmd_str = "def myProg():\n";
                cmd_str += "\twhile (True):\n";
                cmd_str += "\t\tend_freedrive_mode()\n";
                cmd_str +="\t\tsleep(0.5)\n";
                cmd_str += "\tend\n";
                cmd_str +="end\n";
                temp.data = cmd_str;
                pub_free_drive_.publish(temp);
            }

The detail is in ThomasTimm/ur_modern_driver#73


Originally posted by xiaogao with karma: 26 on 2017-12-09

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by ceres on 2019-06-21:
I haven't had any success with the method here. Does this still work with SW vers 5.2.0.61336?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.