Ask Your Question
0

ur_modern_driver and teach_mode() URscript command

asked 2016-11-14 16:51:25 -0500

conor.mcmahon gravatar image

updated 2016-11-17 02:42:20 -0500

gvdhoorn gravatar image

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/script... ) 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.

edit retag flag offensive close merge delete

Comments

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()?

gvdhoorn gravatar imagegvdhoorn ( 2016-11-15 02:00:16 -0500 )edit

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.

gvdhoorn gravatar imagegvdhoorn ( 2016-11-15 02:02:18 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-12-09 01:01:14 -0500

xiaogao gravatar image

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

edit flag offensive delete link more

Comments

I haven't had any success with the method here. Does this still work with SW vers 5.2.0.61336?

ceres gravatar imageceres ( 2019-06-21 12:15:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-11-14 16:51:25 -0500

Seen: 1,294 times

Last updated: Dec 09 '17