How to track a wall (obstacle) using tracking _pid package?

asked 2022-12-10 20:27:56 -0500

Astronaut gravatar image

Hi

I have a mobile robot with dimension and sensor configuration (five sonar ultrasonic sensors and one IMU-9 degree of freedom) as in this photos here mobile robot in gazeboThe mobile robot is using the model of differential driving motion with mixing of sensory(sonar and IMU) information. I would like to use the ROS pid tracking package ros tracking to track the wall as its in the gazebo simulation picturerobot in gazebo with the wall-obstacle.

I have PID controller yaml file with is the following

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

  # Effort Controllers ---------------------------------------
  leftWheel_effort_controller:
    type: effort_controllers/JointEffortController
    joint: left_wheel_hinge
    pid: {p: 100.0, i: 0.1, d: 10.0}
  rightWheel_effort_controller:
    type: effort_controllers/JointEffortController
    joint: right_wheel_hinge
    pid: {p: 100.0, i: 0.1, d: 10.0}

The starting orientation of the robot (rotation with respect to the z axis) which can be set in the launch file is:

angle = mod(X,π) (in rad)

I would like to creates ROS nodes that track (follow) the wall (obstacle) . In the nodes the direction of rotation (the direction in which the obstacle will be tracked) is determined. More specifically, if X is an even number, then the obstacle should be tracked clockwise (CW) with respect to the global coordinate system, while if it is odd the obstacle should be tracked anti-clockwise (CCW).

Here is the launch file with

<launch>

  <!-- these are the arguments you can pass this launch file, for example paused:=true -->
  <arg name="paused" default="false"/>
  <arg name="use_sim_time" default="true"/>
  <arg name="gui" default="true"/>
  <arg name="headless" default="false"/>
  <arg name="debug" default="false"/>
  <arg name="yaw_init" default="0.0"/>

  <!-- Load the URDF into the ROS Parameter Server -->
  <param name="robot_description"
command="$(find xacro)/xacro '$(find mymobibot_description)/urdf/mymobibot.xacro'" />

  <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find mymobibot_gazebo)/worlds/mymobibot_wf.world"/>
    <arg name="debug" value="$(arg debug)" />
    <arg name="gui" value="$(arg gui)" />
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="headless" value="$(arg headless)"/>
  </include>

  <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model mymobibot -Y $(arg yaw_init) -param robot_description"/>

  <!-- Run RVIZ-->
  <!--node name="$(anon rviz)" pkg="rviz" type="rviz" args="$(find mymobibot_gazebo)/mymobibot.rviz" output="screen"/-->

  <!-- ros_control mymobibot launch file -->
  <include file="$(find mymobibot_control)/launch/mymobibot_control.launch" />

</launch>

And the control launch

<launch>

  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find mymobibot_control)/config/mymobibot_control.yaml" command="load"/>

  <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/mymobibot" args="joint_state_controller
 rightWheel_effort_controller
 leftWheel_effort_controller"/> ...
(more)
edit retag flag offensive close merge delete