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

How can obstacle avoidance be achieved for Pioneer 3AT mobile robot using ROS? I am a begineer .

asked 2017-06-14 02:49:39 -0500

vsd gravatar image

Please help me with navigation and obstacle avoidance of the mobile robot using ROS.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-06-30 07:17:13 -0500

Hello vsd,

I think this question is to generic, there's no straight answer for what you want, but I'll try to help you!

The thing is there are a lot of obstacle avoidance methods in the literature, but let's focus on what we have in Pioneer. There are some variations with cameras or lasers, but in general we can work with the ultrasonic sensors.

I've done a simple example using a public simulation in http://rds.theconstructsim.com/simula... , so it's very easy to you to reproduce it. I used the simulation uji_amr_2, which has some obstacles to work with.

  1. Clone this repo to the workspace: https://bitbucket.org/marcoarruda/pio...
  2. Go to ~/catkin_ws/ and execute catkin_make
  3. Launch the obstacle avoidance script: roslaunch pioneer_obstacle_avoidance oa_node.py

You can see in the package pioneer_obstacle_avoidance two scripts: oa_node.py and p3dx.py. The first one has the logic behind the behavior of the robot. The second one is just a initialization file, to provide the robot functionalities to the ROS environment.

The core of the behavior is the following:

while not rospy.is_shutdown():
    val = min(_so2_range, _so3_range, _so4_range, _so5_range)
    if val < 0.3:
        _left_wheel_speed_service(-2)
        _rght_wheel_speed_service(-2)
    elif val >= 0.3 and val < 0.7:
        if min(_so0_range, _so1_range) < min(_so6_range, _so7_range):
            _left_wheel_speed_service(2)
            _rght_wheel_speed_service(0)
        else:
            _left_wheel_speed_service(0)
            _rght_wheel_speed_service(2)
    else:
        _left_wheel_speed_service(2)
        _rght_wheel_speed_service(2)
    rate.sleep()

If there is an obstacle in front of the robot, (sensors 2 to 5), it has to turn left or right. It chooses the better side to turn based on the other sensors data (left side: 0 and 1, right side: 6 and 7)

I hope it can help you!

Cheers!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-06-14 02:49:39 -0500

Seen: 381 times

Last updated: Jun 14 '17