ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Maintaining Fixed Position With Velocity Controller

asked 2022-05-19 20:31:34 -0600

CroCo gravatar image

updated 2022-05-20 14:17:58 -0600

I've implemented a velocity controller for UR5. The issue I'm having is that I can't keep the robot at a fixed posture. Sending zero velocity makes the robot to be pulled downward by the gravity. Even for simple example as shown below, once I start the simulation, the arm falls down. My question is is it possible to maintain a fixed position with velocity controller?

image description

urdf folder robot.xacro, robot.gazebo, materials.xacro

robot.xacro<robot <a="" href="http://xmlns:xacro="http://www.ros.org/wiki/xacro">xmlns:xacro="http://www.ros.org/wiki/..." name="rrbot"> <xacro:property name="width" value="0.1"> <xacro:property name="height1" value="1.5"> <xacro:property name="height2" value="1"> <xacro:property name="axle_offset" value="0.05"> <xacro:property name="damp" value="0.7"></xacro:property></xacro:property></xacro:property></xacro:property></xacro:property></robot>

    <xacro:macro name="default_inertial" params="z_value i_value mass">
        <inertial>
            <origin xyz="0 0 ${z_value}" rpy="0 0 0"/>
            <mass value="${mass}"/>
            <inertia  ixx="${i_value}" ixy="0.0" ixz="0.0" 
                      iyy="${i_value}" iyz="0.0" 
                      izz="${i_value}"/>
        </inertial>
    </xacro:macro>

    <xacro:include filename="$(find position_cont)/urdf/materials.xacro"/>
    <xacro:include filename="$(find position_cont)/urdf/robot.gazebo"/>

    <link name="world"/>
    <joint name="fixed" type="fixed">
        <parent link="world"/>
        <child link="base_link"/>
    </joint>

    <!-- Base Link -->
    <link name="base_link">
        <visual>
            <origin xyz="0 0 ${height1/2}" rpy="0 0 0"/>
            <geometry>
                <box size="${width} ${width} ${height1}"/>
            </geometry>
            <material name="red"/>
        </visual>
        <collision>
            <origin xyz="0 0 ${height1/2}" rpy="0 0 0"/>
            <geometry>
                <box size="${width} ${width} ${height1}"/>
            </geometry>
        </collision>

        <xacro:default_inertial z_value="${height1/2}" i_value="1.0" mass="1" />
    </link>
    <!-- Middle Link -->
    <link name="mid_link">
        <visual>
            <origin xyz="0 0 ${height2/2}" rpy="0 0 0"/>
            <geometry>
                <box size="${width} ${width} ${height2}"/>
            </geometry>
            <material name="green"/>
        </visual>
        <collision>
            <origin xyz="0 0 ${height2/2}" rpy="0 0 0"/>
            <geometry>
                <box size="${width} ${width} ${height2}"/>
            </geometry>
        </collision>
        <xacro:default_inertial z_value="${height2/2}" i_value="1.0" mass="1" />
    </link>

     <!-- Joint Between Base Link and Middle Link -->
     <joint name="joint1" type="revolute">
        <parent link="base_link"/>
        <child link="mid_link"/>
        <origin xyz="0 ${width} ${height1-axle_offset}" rpy="0 0 0"/>
        <axis xyz="0 1 0"/>
        <dynamics damping="${damp}"/>
        <limit effort="100.0" velocity="0.5" lower="-3.14" upper="3.14"/>
    </joint>

    <transmission name="transmission1">
        <type>transmission_interface/SimpleTransmission</type>
        <joint name="joint1">
          <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        </joint>
        <actuator name="motor1">
          <hardwareInterface>EffortJointInterface</hardwareInterface>
          <mechanicalReduction>1</mechanicalReduction>
        </actuator>
    </transmission>


</robot>

robot.gazebo

<?xml version="1.0"?>
<robot>
    <!-- Base Link -->
    <gazebo reference="base_link">
        <material>Gazebo/Red</material>
    </gazebo>

    <!-- Middle Link -->
    <gazebo reference="mid_link">
        <mu1>0.2</mu1>
        <mu2>0.2< ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-05-20 04:41:21 -0600

Joe28965 gravatar image

Could you post the URDF of that simple example?

I'm also wondering if they're proper velocity controllers, or secretly effort controllers that have a slow PID trying to get to the desired velocity. Or if they're simply not operating if 0.0 is send (what would happen if you set the velocity to 0.1?).

It might be the case that no, it's not possible. However, I'm not too versed in the specifics of velocity controllers.

edit flag offensive delete link more

Comments

see the update

CroCo gravatar image CroCo  ( 2022-05-20 14:18:06 -0600 )edit
0

answered 2022-05-20 06:33:36 -0600

Hi, You need some kind of position controller in order to maintain such fixed position.

Sending 0-velocity setpoint would work for a perfect system but only a position control can detect a slight drift and send a non-null velocity to detect it.

The typical cascade would be position error -> velocity setpoint -> low-level effort PID. A simple proportional control is enough for the position -> velocity part.

edit flag offensive delete link more

Comments

This means velocity controller is not suited for manipulators because my understanding the robot must be in a continuous motion, right?

CroCo gravatar image CroCo  ( 2022-05-20 14:08:56 -0600 )edit

Also, for the transmission tag, should I change EffortJointInterface to VelocityJointInterface?

CroCo gravatar image CroCo  ( 2022-05-20 14:19:04 -0600 )edit

As for that last part, yes, probably. I think it's now interpreting your velocity as effort. However, I am not an expert on ros1 and do not guarantee that would work.

Joe28965 gravatar image Joe28965  ( 2022-05-20 14:31:04 -0600 )edit

@Joe28965, changing EffortJointInterface to VelocityJointInterface solved the problem but I'm wondering if the actual robot (i.e. UR5) is equipped with this kind of controller.

CroCo gravatar image CroCo  ( 2022-05-20 14:39:47 -0600 )edit

The actual physical real life UR5? I'm somewhat sure that it actually holds its position.

The Gazebo simulation? You could simply pull the thing from GitHub and use the search function from something like VS Code to check if it has any EffortJointInterface or VelocityJointInterface mentioned in the repo.

Joe28965 gravatar image Joe28965  ( 2022-05-20 14:43:20 -0600 )edit

@Joe28965, I mean the actual one because eventually I will apply it on the real one. In the files, I see transmission_interface/SimpleTransmission

CroCo gravatar image CroCo  ( 2022-05-20 14:53:09 -0600 )edit

how can I switch between position and velocity controllers? Also, about the hardware interface, is it acceptable carry out the switching?

CroCo gravatar image CroCo  ( 2022-05-25 05:00:10 -0600 )edit

I honestly don't know enough about the UR5 to tell you what consequences it would have. It will really depend on how the UR5 is programmed. I would almost say 'just test it and see what happens'

Joe28965 gravatar image Joe28965  ( 2022-05-25 05:04:44 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2022-05-19 20:31:34 -0600

Seen: 419 times

Last updated: May 20 '22