My 4 wheel robot won't turn left or right
Hello everyone, I'm trying to move my own robot but it only does it forward and backward. It doesn't turn left or right. I tried to sample from Husky and Jackal robot but failed. I have a lot of questions in my mind such as do I need to use PID and what are the kp kd values. I would appreciate your answers, thank you.
urdf file
<?xml version="1.0" encoding="utf-8"?>
<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com)
Commit Version: 1.6.0-4-g7f85cfe Build Version: 1.6.7995.38578
For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
<robot name="zafirurdftemplate">
<link name="Zafir_Body">
<inertial>
<origin xyz="0.000160 0.000256 0.000327" rpy="0 0 0" />
<mass value="3.3058" />
<inertia ixx="0.999999" ixy="-0.001114" ixz="-0.000092" iyy="0.999992" iyz="-0.003944" izz="0.999992" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/Zafir_Body.STL" />
</geometry>
<material name="">
<color rgba="0.89412 0.91373 0.92941 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/Zafir_Body_Col.STL" />
</geometry>
</collision>
</link>
<link name="FL_Wheel">
<inertial>
<origin xyz="-0.000102 0.000122 -0.000072" rpy="0 0 0" />
<mass value="102.21" />
<inertia ixx="0.931445" ixy="0.363881" ixz="-0.000820" iyy="0.931445" iyz="0.00027" izz="1.000000" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/FL_Wheel.STL" />
</geometry>
<material name="">
<color rgba="0.29412 0.29412 0.29412 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/FL_Wheel.STL" />
</geometry>
</collision>
</link>
<joint name="FL_Wheel_Rotation_Axis" type="continuous">
<origin xyz="0.28763 0.35 0.16708" rpy="0 0 0" />
<parent link="Zafir_Body" />
<child link="FL_Wheel" />
<axis xyz="0 1 0" />
<limit effort="20" velocity="10" />
</joint>
<link name="FR_Wheel">
<inertial>
<origin xyz="-0.000103 0.000123 -0.000072" rpy="0 0 0" />
<mass value="102.21" />
<inertia ixx="0.929756" ixy="-0.368176" ixz="-0.000711" iyy="0.929756" iyz="0.000027" izz="1.000000" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/FR_Wheel.STL" />
</geometry>
<material name="">
<color rgba="0.29412 0.29412 0.29412 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/FR_Wheel.STL" />
</geometry>
</collision>
</link>
<joint name="FR_Wheel_Rotation_Axis" type="continuous">
<origin xyz="0.28763 -0.35 0.16708" rpy="0 0 0" />
<parent link="Zafir_Body" />
<child link="FR_Wheel" />
<axis xyz="0 1 0" />
<limit effort="20" velocity="10" />
</joint>
<link name="RL_Wheel">
<inertial>
<origin xyz="-0.000102 0.000122 -0.000072" rpy="0 0 0" />
<mass value="102.21" />
<inertia ixx="0.930782" ixy="-0.365575" ixz="0.000217" iyy="0.930782" iyz="-0.000168" izz="1.000000" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/RL_Wheel.STL" />
</geometry>
<material name="">
<color rgba="0.29412 0.29412 0.29412 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/RL_Wheel.STL" />
</geometry>
</collision>
</link>
<joint name="RL_Wheel_Rotation_Axis" type="continuous">
<origin xyz="-0.28763 0.35 0.16708" rpy="0 0 0" />
<parent link="Zafir_Body" />
<child link="RL_Wheel" />
<axis xyz="0 1 0" />
<limit effort="20" velocity="10" />
</joint>
<link name="RR_Wheel">
<inertial>
<origin xyz="-0.000104 0.000124 -0.000072" rpy="0 0 0" />
<mass value="102.21" />
<inertia ixx="0.928109" ixy="0.372307" ixz="0.000833" iyy="0.928110" iyz="-0.000027" izz="1.000000" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/RR_Wheel.STL" />
</geometry>
<material name="">
<color rgba="0.29412 0.29412 0.29412 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://zafirurdftemplate/meshes/RR_Wheel.STL" />
</geometry>
</collision>
</link>
<joint name="RR_Wheel_Rotation_Axis" type="continuous">
<origin xyz="-0.28763 -0.35 0.16708" rpy="0 0 0" />
<parent link="Zafir_Body" />
<child link="RR_Wheel" />
<axis xyz="0 1 0" />
<limit effort="20" velocity="10" />
</joint>
<transmission name="trans_FL_Wheel_Rotation_Axis">
<type>transmission_interface/SimpleTransmission</type>
<joint name="FL_Wheel_Rotation_Axis">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="FL_Wheel_Rotation_Axis_motor">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<transmission name="trans_FR_Wheel_Rotation_Axis">
<type>transmission_interface/SimpleTransmission</type>
<joint name="FR_Wheel_Rotation_Axis">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="FR_Wheel_Rotation_Axis_motor">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<transmission name="trans_RL_Wheel_Rotation_Axis">
<type>transmission_interface/SimpleTransmission</type>
<joint name="RL_Wheel_Rotation_Axis">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="RL_Wheel_Rotation_Axis_motor">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<transmission name="trans_RR_Wheel_Rotation_Axis">
<type>transmission_interface/SimpleTransmission</type>
<joint name="RR_Wheel_Rotation_Axis">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="RR_Wheel_Rotation_Axis_motor">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/</robotNamespace>
</plugin>
control.launch
<launch>
<!-- <arg name="enable_ekf" default="$(optenv ENABLE_EKF true)"/> -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="paused" value="true"/>
</include>
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find zafirurdftemplate)/config/diff.yaml" command="load"/>
<param name="robot_description" command="cat $(find zafirurdftemplate)/urdf/zafirurdftemplate.urdf"/>
<node name="spawn_robot" pkg="gazebo_ros" type="spawn_model" respawn= "false" output="screen"
args="-urdf -model zafirurdftemplate -param robot_description -z 0.0"/>
<!-- load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" args="zafir_joint_publisher zafir_velocity_controller"/>
<!-- <node pkg="interactive_marker_twist_server" type="marker_server" name="twist_marker_server" output="screen">
<param name="link_name" value="Zafir_Body" />
</node> -->
<!-- <group if="$(arg enable_ekf)" >
<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization">
<rosparam command="load" file="$(find zafirurdftemplate)/config/localization.yaml" />
</node>
</group> -->
<!-- convert joint states to TF transforms for rviz, etc -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
respawn="false" output="screen">
<remap from="/joint_states" to="/zafirurdftemplate/joint_states" />
diff.yaml
zafir_joint_publisher:
type: "joint_state_controller/JointStateController"
publish_rate: 50
zafir_velocity_controller:
type: "diff_drive_controller/DiffDriveController"
left_wheel: ['FL_Wheel_Rotation_Axis', 'RL_Wheel_Rotation_Axis']
right_wheel: ['FR_Wheel_Rotation_Axis', 'RR_Wheel_Rotation_Axis']
publish_rate: 50
pose_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
cmd_vel_timeout: 0.25
velocity_rolling_window_size: 2
# Base frame_id
base_frame_id: Zafir_Body
# Odometry fused with IMU is published by robot_localization, so
# no need to publish a TF based on encoders alone.
enable_odom_tf: false
# Wheel separation and radius multipliers
wheel_separation_multiplier: 1.875 # default: 1.0
wheel_radius_multiplier : 1.0 # default: 1.0
# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
linear:
x:
has_velocity_limits : true
max_velocity : 1.0 # m/s
has_acceleration_limits: true
max_acceleration : 3.0 # m/s^2
angular:
z:
has_velocity_limits : true
max_velocity : 2.0 # rad/s
has_acceleration_limits: true
max_acceleration : 6.0 # rad/s^2
Asked by dogukan on 2022-10-04 07:04:47 UTC
Comments