Nightbane112 / alphabot2-simulator

Alphabot2 simulator using ROS and Gazebo Simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alphabot2-Pi ROS Package and Simulator

This repo provides a testbed for experimentation and some show-stopper changes may render this build unuseable. Proceed with caution.

Installation and Dependencies

  • ROS distro: ROS Kinetic

  • Ubuntu version: Ubuntu 16.04 LTS (Xenial)

  • Gazebo version: Gazebo 7.0

Perform the full installation for the ROS Kinetic that comes with Gazebo 7.0

Directory Organization

In the root of the repository, every folder represents a ROS package (except for pictures, used to hold images for this Readme and source files for the report, respectively). Inside each package folder, we have the usual CMakeLists.txt and package.xml, along with a launch/ folder (if there are launch files in the package) and a src/ folder (if there is any code in the package). In some special cases (such as alphabot2_world and alphabot2_pantilt), packages may have other folders whose names will be self-explanatory for ease of use.

Building

Clone this repository into the src folder inside the catkin workspace and compile it.

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone https://github.com/ssscassio/alphabot2-simulator.git
cd ..
catkin_make
source devel/setup.bash
chmod +x src/alphabot2-simulator/**/*.py

Running

Simulation (Gazebo):

To launch the simulation world run:

roslaunch alphabot2_world spawn_world.launch

To spawn the robot inside the world run:

roslaunch alphabot2_world spawn_robot.launch

To launch the pan tilt control node run:

roslaunch alphabot2_pantilt alphabot2_pantilt_gazebo.launch

To start the bottom sensors middleman node run:

rosrun alphabot2_sensors_middleman BottomSensorsMiddleman.py

To start the top sensors middleman node run:

rosrun alphabot2_sensors_middleman TopSensorsMiddleman.py

To launch the robot movement created by the sensors node run:

roslaunch alphabot2_control gazebo_sensors_control.launch

Real Robot:

To launch the control node run:

roslaunch alphabot2_control alphabot2_control_real.launch

To launch the pan tilt control node run:

roslaunch alphabot2_pantilt alphabot2_pantilt_control_real.launch

To start the alphabot2 node to handler with top sensors, bottom sensors and drive control run:

roslaunch alphabot2_control alphabot2_robot_handler.launch

To launch the robot movement created by the sensors node run:

roslaunch alphabot2_control alphabot2_sensors_control.launch

ROS architecture

Rosgraph for the simulation world

Rosgraph for real alphabot Rosgraph for sensors and control using sensors














Description of ROS nodes

  • alphabot2_control_node_real: Subscribe to /alphabot2/control and translate it to drive control the Alphabot2. (This node only runs on a RaspberryPI)
  • alphabot2_pantilt_node_real: Subscribe to /alphabot2/vertical and /alphabot2/horizontal topics and control the Pan and Tilt position of the RaspCam on Alphabot2. (This node only runs on a RaspberryPI)
  • alphabot2_pantilt_node_gazebo: Same of alphabot2_pantilt_node_real but controls Gazebo model virtual joints instead of real robot Pan-Tilt.
  • alphabot2_top_sensors_middleman: Receives info from Gazebo top sensors and retransmits in standardized format to /alphabot2/top_sensors.
  • alphabot2_bottom_sensors_middleman: Receives info from Gazebo bottom sensors and retransmits in standardized format to /alphabot2/bottom_sensors.
  • alphabot2_handler: Read information provide by Alphabot2's Infrared sensors and retransmits in standardized format to /alphabot2/top_sensors and /alphabot2/bottom_sensors. Also subscribe to /alphabot2/control and translate it to drive control the Alphabot2. (This node only runs on a RaspberryPI)

Description of ROS Topics:

  • /alphabot2/control: Used to control the robot movement, geometry_msgs/Twist to be publish
  • /alphabot2/vertical: Used to control Tilt from Pan-Tilt using std_msgs/Float64 (degree between -90 and 90)
  • /alphabot2/horizontal: Used to control Pan from Pan-Tilt using std_msgs/Float64 (degree between -90 and 90)
  • /alphabot2/camera/image_raw: Publishes sensor_msgs/Image from the camera module.
  • /alphabot2/top_sensors: Receives the result of the top sensors to be used by the real robot and the simulated robot. (Message type: std_msgs/Int32MultiArray)
  • /alphabot2/bottom_sensors: Receives the result of the bottom sensors to be used by the real robot and the simulated robot. (Message type: std_msgs/Int32MultiArray)

Testing controls

To control robot movement publish a geometry_msgs/Twist to /alphabot2/control topic:

rostopic pub /alphabot2/control geometry_msgs/Twist (Press Tab)

To control camera movement publish a std_msgs/Float64 to /alphabot_horizontal or /alphabot2/vertical topics with a angle between -90 and 90 degrees:

Pan

rostopic pub /alphabot2/horizontal std_msgs/Float64 "data: 45"

Tilt

rostopic pub /alphabot2/vertical std_msgs/Float64 "data: -23"

To check that it's being published the correct sensors results to the real robot and the simulated robot:

Top Sensors

rostopic echo /alphabot2/top_sensors

Bottom Sensors

rostopic echo /alphabot2/bottom_sensors

References

See upstream repository here (https://github.com/ssscassio/alphabot2-simulator)

About

Alphabot2 simulator using ROS and Gazebo Simulator


Languages

Language:CMake 57.2%Language:Python 36.6%Language:C++ 6.2%