aquanaute_gazebo.urdf.xacro 3.91 KB
<?xml version="1.0"?>
<!-- Basic WAM-V with gazebo plugins for dynamics -->
<robot xmlns:xacro="http://ros.org/wiki/xacro">
    <!-- Include macros for dynamics plugins 
    <xacro:include filename="$(find aquanaute_gazebo)/urdf/macros.xacro" /> -->
    <!-- Defines the base vehicle -->
    <xacro:include filename="$(find aquanaute_description)/urdf/aquanaute_description.urdf.xacro"/>

    <!-- Defines the sim plugins-->

    <gazebo reference="base_link">
        <kp>100000.0</kp>
        <kd>100000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/Grey</material>
    </gazebo>

    <gazebo reference="platform_link">
        <kp>100000.0</kp>
        <kd>100000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/Grey</material>
    </gazebo>

    <gazebo reference="right_hull_link">
        <kp>100000.0</kp>
        <kd>100000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/Red</material>
    </gazebo>

    <gazebo reference="left_hull_link">
        <kp>100000.0</kp>
        <kd>100000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/Red</material>
    </gazebo>

    <gazebo reference="motor_link">
        <kp>100000.0</kp>
        <kd>100000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/Black</material>
    </gazebo>

    <gazebo reference="propeller_link">
        <kp>100000.0</kp>
        <kd>100000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/Black</material>
    </gazebo>

    <gazebo reference="sensor_frame_link">
        <kp>100000.0</kp>
        <kd>100000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/White</material>
    </gazebo>

    <gazebo>
        <link name="imu_link">
            <sensor name="imu_sensor" type="imu">
                <pose>0 0 0 3.141593 0 0</pose>
                <always_on>1</always_on>
                <update_rate>1000.0</update_rate>
            </sensor>
        </link>
    </gazebo> 

    <!-- * * * GAZEBO Plugins * * * -->
    <gazebo>
        <plugin name="ardupilot_plugin" filename="libArduPilotPlugin.so">
            <fdm_addr>127.0.0.1</fdm_addr>
            <fdm_port_in>9002</fdm_port_in>
            <fdm_port_out>9003</fdm_port_out>
            <modelXYZToAirplaneXForwardZDown>0 0 0 3.141593 0 0</modelXYZToAirplaneXForwardZDown>
            <gazeboXYZToNED>0 0 0 3.141593 0 0</gazeboXYZToNED>
            <imuName>imu_sensor</imuName>
            <connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
            <!--
            incoming control command [0, 1]
            so offset it by 0 to get [0, 1]
            and divide max target by 1.
            offset = 0
            multiplier = 838 max rpm / 1 = 838
            -->
            <control channel="0">
                <multiplier>1</multiplier>
                <offset>-0.5</offset>
                <type>POSITION</type>
                <p_gain>1</p_gain>
                <i_gain>0</i_gain>
                <d_gain>0</d_gain>
                <i_max>0</i_max>
                <i_min>0</i_min>
                <cmd_max>1</cmd_max>
                <cmd_min>-1</cmd_min>
                <jointName>aquanaute::motor_platform_joint</jointName>
            </control>
            
            <control channel="1">
                <multiplier>1</multiplier>
                <offset>-0.5</offset>
                <type>VELOCITY</type>
                <p_gain>1</p_gain>
                <i_gain>0</i_gain>
                <d_gain>0</d_gain>
                <i_max>0</i_max>
                <i_min>0</i_min>
                <cmd_max>1</cmd_max>
                <cmd_min>-1</cmd_min>
                <jointName>aquanaute::propeller_motor_joint</jointName>
            </control>
            
        </plugin>
    </gazebo>
    <!-- Attach hydrodynamics plugin 
    <xacro:usv_dynamics_gazebo name="aquanaute_dynamics_plugin"/> -->
</robot>