Project in action : Watch on youtube
Create a new directory in <catkin_workspace>/src/testbot_description
and clone all of project files to that folder.
sample commands:
mkdir ~/catkin_ws/src/testbot_description
cd ~/catkin_ws/src/testbot_description
git clone https://github.com/vibhuthasak/Obstacle_Avoidance_ROS.git
cd ~/catkin_ws
catkin_make
-
First you need to Launch the ROS node.
roslaunch testbot_description testbot_gazebo.launch
testbot_description is the package name that I gave. And testbot_gazebo.launch file can be found at /launch folder After executing this command, Gazebo will open like below.
Everthing looking great so far right ?
-
Now you need to run the python script that is created to listen sensor data from our virtual robot and move the robot.
rosrun testbot_description sensor_data_listerner.py
The python script is available at Obstacle_Avoidance_ROS/scripts/sensor_data_listener.py path.
The script is simply subcribes to /scan
topic's sensor_msgs.msg.LaserScan
message. The message is modified using the LaserScanProcess()
function.
rospy.Subscriber("scan", sensor_msgs.msg.LaserScan , LaserScanProcess)
And it is publishing commands to /cmd_vel
topic and the message type is Twist.
pub = rospy.Publisher('/cmd_vel', Twist, queue_size=10)
If you echo the /cmd_vel
topic using following command
rostopic echo cmd_vel
You will see it is printing Linear and Angular velocities.
DONE