Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use ur_modern_driver in gazebo #176

Closed
geweihgg opened this issue May 31, 2018 · 33 comments
Closed

How to use ur_modern_driver in gazebo #176

geweihgg opened this issue May 31, 2018 · 33 comments

Comments

@geweihgg
Copy link

Hi,
I want to use ur_modern_driver to publish joint speed commands to control the ur5 arm in gazebo, so I clone this repository and catkin_make it. Then I rewrite the ur5.launch file to load ur_modern_driver/config/ur5_controllers.yaml, and spawn it. But some errors occur like this:
ur_modern_driver
Can you help me?
Um... Maybe a clear tutorial on how to use ur_modern_driver with ur5 in gazebo is perfect.
Thank you very much.
GeWei

@gavanderhoorn
Copy link
Member

The driver cannot be used with Gazebo, as it doesn't simulate a UR controller, but only a robot mechanism.

Um... Maybe a clear tutorial on how to use ur_modern_driver with ur5 in gazebo is perfect.

It would just state that it will not work, so I doubt that would be very useful.

@gavanderhoorn
Copy link
Member

You might have more luck with ursim, a 'simulation' provided by Universal Robots themselves.

That can be used with ur_modern_driver. Just connect to 127.0.0.1 after you've started ursim.

@geweihgg
Copy link
Author

Hi, @gavanderhoorn ,
Thank you very much, I'll try it~
GeWei

@geweihgg
Copy link
Author

geweihgg commented Jun 1, 2018

Hi, @gavanderhoorn ,
I have one more question, can I use velocity control command to control UR in gazebo? Or is it simple to do this? All I want is to control ur5 in gazebo with velocity control command. But I don't know whether it's hard or not.
Can you give me some advice?
GeWei

@gavanderhoorn
Copy link
Member

gavanderhoorn commented Jun 1, 2018

Using gazebo_ros_control you could probably configure a velocity_controllers/JointGroupVelocityController (for all joints) or a velocity_controllers/JointVelocityController (for individual joints).

You should then be able to provide that with appropriate input and control it.

As to whether that is simple: I don't know. That will depend on your experience and a lot of other factors.

@gavanderhoorn
Copy link
Member

Btw:

All I want is to control ur5 in gazebo with velocity control command.

be careful with sentences that start with All or contain the word just: the things that follow or accompany those words are often not as simple, easy or straightforward to do as is implied by using those words.

@geweihgg
Copy link
Author

geweihgg commented Jun 1, 2018

Hi, @gavanderhoorn ,
Thank you for your advice~
^-^
GeWei

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

Hi, @gavanderhoorn ,
I want to implement a velocity interface based on position controller in gazebo, but I don't know how to implement it. So I wonder how the ur_modern_driver solve this, can you tell me how the ur_modern _driver works? By integrating the velocity to position or some other methods?
Thank you very very much~
GeWei

@gavanderhoorn
Copy link
Member

So I wonder how the ur_modern_driver solve this, can you tell me how the ur_modern _driver works? By integrating the velocity to position or some other methods?

The UR controller exposes a velocity control interface (ie: you can directly control joint velocity). That is what the driver uses.

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

Hi, @gavanderhoorn ,
Yes, but the velocity control interface is only for the hardware, and I want to control UR in gazebo with velocity mode. Maybe integrating the velocity command and then publish it to the position interface is a feasible way?
GeWei

@gavanderhoorn
Copy link
Member

gavanderhoorn commented Jul 5, 2018

For gazebo you'll want to make sure you load the correct controller from ros_control and make sure the Gazebo xacro enabled the correct hardware interface (not the position one). The files in ur_gazebo don't use anything from ur_modern_driver, but load gazebo_ros_control.

Maybe integrating the velocity command and then publish it to the position interface is a feasible way?

If you use the correct hardware interface in the xacro, that is not necessary.

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

I tried to load the velocity controller for UR in gazebo, and then I found that I should adjust the PID parameters for the controller, but I didn't know how to got the right parameters. Do you have any suggestions?
Thank you~

@gavanderhoorn
Copy link
Member

No, unfortunately not, other than try to use the regular way of tuning parameters of a PID. I haven't used it myself so I cannot guide you.

But a note: as soon as you start using actual controllers (so not just transparent pass-through), tuning parameters is going to be needed there is no way around it.

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

Oh, I see. Thank you very much.
By the way, Isn't the UR velocity control interface based on the position controller?

@gavanderhoorn
Copy link
Member

Isn't the UR velocity control interface based on the position controller?

which "velocity control interface" are you now referring to here?

The real one robot+controller, or the simulated one?

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

The real one robot + controller, i.e. the velocity control mode in ur_modern_driver.

@gavanderhoorn
Copy link
Member

That would be something only UR can authoritatively answer, but I would expect the answer to be "no". Why would it have to be position based? The internal controller can just look at dx/dt and increase/descrease motor current to achieve a desired rotational velocity.

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

Ok, I think the following words confuses me (It's copied from the ur_modern_driver/README.md):
2018-07-05 4 04 50
It says that the velocity based controller controls the joint position too. I'm confused about this. Isn't the velocity based controller controls the robot with desired joint velocity?

@gavanderhoorn
Copy link
Member

gavanderhoorn commented Jul 5, 2018

That is a position controller implemented using velocity control.

Input: position setpoint
Output: velocity command to actuator

To control joint velocity, use the /joint_speed topic.

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

But in ur_modern_driver/README.md, the usage is:
2018-07-05 4 41 18
So if I want to use this interface, I need to specify the velocity and acceleration in the first JointTrajectoryPoint. How about the position term? Set the position to zero? I'm not sure whether I understand it correctly.

@gavanderhoorn
Copy link
Member

You need to pass a JointTrajectory containing a single JointTrajectoryPoint with the desired velocities and accelerations for that specific control iteration. Position is ignored.

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

Oh, I see. I think I've figured out the problem.
So if I want to control the UR with velocity mode in gazebo, I should load the velocity controller, and tune the PID parameters. I'll try it.
Thank you for your patience~ ^-^
GeWei

@gavanderhoorn
Copy link
Member

Yes (and make sure to use the appropriate hardware interface in the xacro), but please understand that all of that has nothing to do with ur_modern_driver.

@geweihgg
Copy link
Author

geweihgg commented Jul 5, 2018

Ok, Thank you~

@nag92
Copy link

nag92 commented Aug 2, 2018

@geweihgg have you had any luck?

@geweihgg
Copy link
Author

geweihgg commented Aug 2, 2018

@nag92 , yes, changing the controllers from position_controllers/JointTrajectoryController to velocity_controllers/JointVelocityController is ok, then we can tune the PID parameters with rqt_gui.

@nag92
Copy link

nag92 commented Aug 2, 2018

Would I be able to take a look at your code?

@geweihgg
Copy link
Author

geweihgg commented Aug 2, 2018

Yes, I'll show you the code tomorrow~

@geweihgg
Copy link
Author

geweihgg commented Aug 3, 2018

@nag92 , the JointVelocityController codes are listed bellow:

# For all joints
arm_vel_controller:
    type: velocity_controllers/JointGroupVelocityController
    joints:
     - shoulder_pan_joint
     - shoulder_lift_joint
     - elbow_joint
     - wrist_1_joint
     - wrist_2_joint
     - wrist_3_joint

And if you want to control the arm with JointPositionController, you can add it into the controller.yaml file.

@Shaluols
Copy link

@geweihgg
Hi, I am also trying to use velocity control for the ur in the gazebo. However, the velocity control cannot work well, there is always gravity pull the links falling down. And in the beginning of loading the gazebo, the robot arm can not stand up at a target pose.
Have you encountered this problem? Could you give me some suggestions?

Thanks in advance!

@geweihgg
Copy link
Author

geweihgg commented Oct 25, 2019 via email

@Shaluols
Copy link

Hi GeWei,

Could you give me some guidance for tuning the PID for the velocity controller?
Is the velocity controller follow the gazebo_ros_controller's PID parameters?
I really have problems tuning the velocity parameters. I found I need to change the PID parameters in the gazebo_ros_controller to make it affect the velocity controllers. And at the same time, I also need to compensate for the gravity that pulling the links down to the ground.....

@ipa-nhg
Copy link

ipa-nhg commented Oct 29, 2019

I think this issue is not related with ur_modern_driver but with universal_robot repository.

Please see the following open issues:
ros-industrial/universal_robot#462
ros-industrial/universal_robot#386
And the PR: ros-industrial/universal_robot#443

So far, unfortunately, we couldn't find a proper solution for this problem, please follow and comment the previously mentioned discussions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants