Universal_Robots_ROS_Driver icon indicating copy to clipboard operation
Universal_Robots_ROS_Driver copied to clipboard

Implemented ROS topic to enable the freedrive mode.

Open t-schnell opened this issue 3 years ago • 12 comments

Implements a basic way to enable freedrive_mode via a ROS topic.

To test: send a message to the "enable_freedrive_mode" topic with a float value specifying seconds to be in freedrive mode.

Using "0.0" will enter freedrive_mode until the robot stops being moved continously (and at least 3 seconds to allow for start of the movement).

As a script is sent to the robot directly, the External Control program will be stopped and thus has to be restarted before regular ROS control can resume.

This is not a final implementation of this feature.

t-schnell avatar Jun 13 '22 12:06 t-schnell

Thanks for the feature draft! We'll definitely try this - once our HW is free for testing

What's the motivation for topic activation - over e.g. service/action? I think an action interface would be nice as the driver/server could deny to switch to freedrive mode or abort in case of error...also the client could cancel freedrive mode early if no longer needed...and the duration could still be set in the goal resulting in a succeeded case to achieve the same behavior as with the plain topic-based interface...

fmessmer avatar Jun 14 '22 05:06 fmessmer

I've added a code block below for enter_freedrive_node service that we use. It is defined after set_payload_srv in hardware_interface.cpp.

  // Setup freedrive mode through a ROS service
  enable_freedrive_mode_srv_ = robot_hw_nh.advertiseService<std_srvs::TriggerRequest::Request, std_srvs::TriggerResponse::Response>(
      "enable_freedrive_mode", [&](std_srvs::TriggerRequest& req, std_srvs::TriggerResponse& res) {
        std::stringstream cmd;
        cmd << "def enterFreedrive():" << std::endl
            << " while (True):" << std::endl
            << "  freedrive_mode()" << std::endl
            << "  sync()" << std::endl
            << " end" << std::endl
            << "end";
        resp.success = this->ur_driver_->sendScript(cmd.str());
        return true;
      });

Our client code calls /ur_hardware_interface/dashboard/stop before calling this enter freedrive service (with delay of 0.5s in between) to enter freedrive mode from remote control, and go back to remote control by calling /ur_hardware_interface/dashboard/stop -> sleep 0.5s -> /ur_hardware_interface/dashboard/play.

shuobh avatar Jun 15 '22 18:06 shuobh

Finally, I was able to test this feature on our HW and it worked out of the box :+1: So far, we don't have any explicit requirements for what the interface (topic, service, action) should be - as we are still experimenting... Thus, I'd be ok to get this merged and modify/extend the interface lateron....

fmessmer avatar Sep 07 '22 11:09 fmessmer

Before merging, I think at least some basic documentation should be added.

fmauch avatar Sep 21 '22 08:09 fmauch

This PR hasn't made any progress for quite some time and will be closed soon. Please comment if it is still relevant.

github-actions[bot] avatar Jan 25 '23 22:01 github-actions[bot]

@ github-actions I'm still interested in this feature! (hope this keeps it open :wink:)

fmessmer avatar Jan 26 '23 07:01 fmessmer

This is currently being worked on in https://github.com/UniversalRobots/Universal_Robots_Client_Library/pull/138 and is not forgotten ;-)

fmauch avatar Jan 26 '23 15:01 fmauch

This PR hasn't made any progress for quite some time and will be closed soon. Please comment if it is still relevant.

github-actions[bot] avatar Apr 26 '23 22:04 github-actions[bot]

this github-actions is really annoying!

fmessmer avatar Apr 27 '23 04:04 fmessmer

This PR hasn't made any progress for quite some time and will be closed soon. Please comment if it is still relevant.

github-actions[bot] avatar Jul 27 '23 22:07 github-actions[bot]