Ask Your Question
0

How to control self-built wheels in gazebo ?

asked 2018-10-02 07:12:21 -0500

stefanvan gravatar image

updated 2018-11-02 12:21:18 -0500

I create an urdf file for a robot with four special wheel sets, each set consists of two cylinders. Of the two cylinders, the upper one rotates around the z-axis, which drives the robot to turn, and the lower one is to drive the robot forward or backward (the picture below is a screenshot of this robot model). Now I want to make this robot move in gazebo. How to control such a robot in gazebo ?

image description

edit retag flag offensive close merge delete

Comments

Have you defined transmissions for every wheel already? http://gazebosim.org/tutorials/?tut=r...

kump gravatar image kump  ( 2018-10-02 10:08:17 -0500 )edit

@kump The website you provided says "Currently only effort interfaces are implemented. (feel free to add more)". Is it feasible to use the effort interfaces to drive my robot?

stefanvan gravatar image stefanvan  ( 2018-10-03 06:55:06 -0500 )edit

Depends what you need. For wheels I have used the VelocityJointInterface and it works as expected, so far. <type>transmission_interface/SimpleTransmission</type> <hardwareinterface>hardware_interface/VelocityJointInterface</hardwareinterface>

kump gravatar image kump  ( 2018-10-03 07:09:47 -0500 )edit

Effort interface is good for setting position of the joint, so maybe you actually want that for the upper cylinders.

kump gravatar image kump  ( 2018-10-03 07:11:22 -0500 )edit

I found a nice list of possible controllers: http://wiki.ros.org/ros_control . I think I used the wrong controller. It makes more sense to use joint_velocity_controller from effort_controllers. That means: type: effort_controllers/JointVelocityController; hardwareInterface: EffortJointInterface;

kump gravatar image kump  ( 2018-10-03 08:38:34 -0500 )edit

@kump If I set the transmission for each joint, and then write a yaml file to load multiple controllers onto the parameter server. This means that each controller controls its corresponding joint, then the controllers can't work cooperatively. How does the model move?

stefanvan gravatar image stefanvan  ( 2018-10-04 07:30:24 -0500 )edit

@jn-chen It moves exactly as a real robot. Either you have a motor for every wheel and you actuate every wheel by its own motor. Or multiple wheels are connected to a rod or something. The rod is actuated by a motor and the movement transfers to the wheels.

kump gravatar image kump  ( 2018-10-04 09:10:56 -0500 )edit

@jn-chen If you want two motors to actuate wheels with the same effort, you just send the same commands to both motors at the same time.

kump gravatar image kump  ( 2018-10-04 09:12:04 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-10-16 03:36:46 -0500

kump gravatar image

updated 2018-11-02 10:32:21 -0500

First of all, you need to add a motor to every element you want to actuate. In your case you said you want to actuate all the wheels, so fior 4 actuated wheels:

Wheels rotation axes

the steps are following:

1) make a control package for your robot.

/robot_control
- /config
    - robot_control.yaml
- /launch
    - robot_control.launch 
-CMakeLists.txt
-package.xml

2) define transmissions

You want to have 8 actuators in your model. For each wheel and for each disk. To add an actuator (for example motor) to your model, you need to add the transmission tag to the joint you want to actuate. The transmission tag contains the hardware interface for the joint. In this case you would add something like this to your urdf file:

robot.urdf:

<!-- Rear wheels transmission -->
<transmission name="transmission_rear_left_wheel">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_rear_left_wheel">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_rear_left_wheel">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

<transmission name="transmission_rear_right_wheel">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_rear_right_wheel">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_rear_right_wheel">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

<!-- Rear disks transmission -->
<transmission name="transmission_rear_left_disk">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_rear_left_disk">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_rear_left_disk">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

<transmission name="transmission_rear_right_disk">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_rear_right_disk">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_rear_right_disk">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

<!-- Front wheels transmission -->
<transmission name="transmission_front_left_wheel">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_front_left_wheel">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_front_left_wheel">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

<transmission name="transmission_front_right_wheel">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_front_right_wheel">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_front_right_wheel">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

 <!-- Front disks transmission -->
<transmission name="transmission_front_left_disk">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_front_left_disk">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_front_left_disk">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

<transmission name="transmission_front_right_disk">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint_front_right_disk">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor_front_right_disk">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>

3) define controllers

Now you have to write a .yaml file where you define type of the controller for each joint and the PID parameters (best to find experimentally in Gazebo clinet).

robot_control.yaml:

robot:
  # Publish all joint states -----------------------------------
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50  

  # Velocity Controllers -----------------------------------------
  joint_rear_left_wheel_controller:
    type: effort_controllers/JointVelocityController
    joint: joint_rear_left_wheel
    pid: {p: 100.0, i: 10.0, d: 0.01}

  joint_rear_right_wheel_controller:
    type: effort_controllers/JointVelocityController
    joint: joint_rear_right_wheel
    pid: {p: 100.0, i: 10.0, d: 0.01}

  joint_front_left_wheel_controller:
    type: effort_controllers/JointVelocityController
    joint: joint_front_left_wheel
    pid: {p: 100.0, i: 10.0, d: 0.01}

  joint_front_right_wheel_controller:
    type: effort_controllers/JointVelocityController
    joint: joint_front_right_wheel
    pid: {p: 100.0, i: 10.0, d: 0.01}

  # Position Controllers -----------------------------------------
  joint_rear_left_disk_controller:
    type: effort_controllers/JointPositionController
    joint: joint_rear_left_disk
    pid: {p: 10.0, i: 1.0, d: 0.01}

  joint_rear_right_disk_controller:
    type: effort_controllers/JointPositionController
    joint: joint_rear_right_disk
    pid: {p: 10.0, i: 1.0, d: 0.01}

  joint_front_left_disk_controller:
    type: effort_controllers ...
(more)
edit flag offensive delete link more

Comments

Thank you very much for your detailed guidance. This helps me a lot and solves a lot of my doubts.

stefanvan gravatar image stefanvan  ( 2018-11-02 09:52:32 -0500 )edit

@kump Actually, if you want to upload images, you only need to copy the Markdown link given by imgur and paste the link(need to add a ! in front of the link) into the input box of this forum. Then the picture will naturally show up.

stefanvan gravatar image stefanvan  ( 2018-11-02 10:05:36 -0500 )edit

Example:

![Imgur](https://i.imgur.com/1qfr0MK.png)

Selection_0033d456.md.png

stefanvan gravatar image stefanvan  ( 2018-11-02 10:08:40 -0500 )edit

@kump In addition, there is a good website that provides multiple forms(different size of photos) of Markdown links when the image is uploaded.

stefanvan gravatar image stefanvan  ( 2018-11-02 10:13:09 -0500 )edit

Thank you. Luckily I kept the images so I uploaded them all now and added to the answer.

kump gravatar image kump  ( 2018-11-02 10:33:14 -0500 )edit

@kump@jn-chen: please do not use imgur to upload images. There is no need: ROS Answers allows you to attach images to your posts / answers directly. If your imgur img disappears, the images here disappear as well.

Both of you have enough karma to attach images directly. Please do that.

gvdhoorn gravatar image gvdhoorn  ( 2018-11-02 13:29:28 -0500 )edit

@gvdhoorn Sorry. I do have enough karma now, but I didn't have enough karma when I wrote this answer. This policy is stupid. Question and answers are always more clear if people can attach images. Why to deny that to the new member? This makes no sense.

kump gravatar image kump  ( 2018-11-03 15:27:29 -0500 )edit

The policy makes perfect sense as it avoids a lot of spam using images.

Would you want ROS Answers overrun with advertisement bots?

gvdhoorn gravatar image gvdhoorn  ( 2018-11-04 01:39:53 -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: 2018-10-02 07:12:21 -0500

Seen: 1,204 times

Last updated: Nov 02 '18