First commit.
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*~
|
||||
*#
|
||||
*.o
|
||||
ias-ss
|
22
LICENSE
Normal file
22
LICENSE
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2016, Miguel Angel Astor Romero
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
19
Makefile
Normal file
19
Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
CXX = g++
|
||||
TARGET = ias_ss
|
||||
OBJECTS = ias_ss.o robot.o
|
||||
CFLAGS = -ansi -pedantic -Wall -g `pkg-config --cflags playerc++` -g
|
||||
LDLIBS = `pkg-config --libs playerc++` -lboost_system -lpthread
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CXX) $(CFLAGS) -o $(TARGET) $(OBJECTS) $(LDLIBS)
|
||||
|
||||
-include $(OBJECTS:.o=.d)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c $(CFLAGS) $*.cpp -o $*.o
|
||||
$(CXX) -MM $(CFLAGS) $*.cpp > $*.d
|
||||
|
||||
clean:
|
||||
$(RM) $(TARGET) $(OBJECTS) *.d
|
16
README.org
Normal file
16
README.org
Normal file
@@ -0,0 +1,16 @@
|
||||
* IAS-SS
|
||||
|
||||
** Abstract
|
||||
IAS-SS (Inverse Ant System-based Surveillance System) is a [[http://playerstage.sourceforge.net/][Player/Stage]] based C++ implementation of the bio-inspired control architecture presented in the
|
||||
following papers:
|
||||
|
||||
1) R. Calvo et al. "/Inverse ACO for Exploration and Surveillance in Unknown Environments/", The Third International Conference on Advanced Cognitive Technologies and Applications, Rome, Italy 2011.
|
||||
2) R. Calvo et al. "/A Distributed, Bio-Inspired Coordination Strategy for Multiple Agent Systems Applied to Surveillance Tasks in Unknown Environments/", Proc. of the IEEE IJCNN, San Jose, USA, 2011.
|
||||
|
||||
This is being developed as part of the Robotics and Bio-Inspired Learning graduate course at UCV.
|
||||
|
||||
Future versions of this README file will include a technical report on the developed software.
|
||||
|
||||
** Notes
|
||||
|
||||
The file ~maps/cave.png~ is part of the standard Stage distribution.
|
35
ant.cfg
Normal file
35
ant.cfg
Normal file
@@ -0,0 +1,35 @@
|
||||
driver
|
||||
(
|
||||
name "stage"
|
||||
plugin "stageplugin"
|
||||
provides [ "simulation:0" ]
|
||||
worldfile "ant.world"
|
||||
)
|
||||
|
||||
driver
|
||||
(
|
||||
name "stage"
|
||||
provides [ "6666:position2d:0" ]
|
||||
model "ant_robot_1"
|
||||
)
|
||||
|
||||
driver
|
||||
(
|
||||
name "stage"
|
||||
provides [ "6667:position2d:0" ]
|
||||
model "ant_robot_2"
|
||||
)
|
||||
|
||||
driver
|
||||
(
|
||||
name "stage"
|
||||
provides [ "6668:position2d:0" ]
|
||||
model "ant_robot_3"
|
||||
)
|
||||
|
||||
driver
|
||||
(
|
||||
name "stage"
|
||||
provides [ "6669:position2d:0" ]
|
||||
model "ant_robot_4"
|
||||
)
|
46
ant.world
Normal file
46
ant.world
Normal file
@@ -0,0 +1,46 @@
|
||||
include "map.inc"
|
||||
include "ant_bot.inc"
|
||||
|
||||
window
|
||||
(
|
||||
size [ 635.000 666.000 ] # in pixels
|
||||
scale 36.995 # pixels per meter
|
||||
center [ -0.040 -0.274 ]
|
||||
rotate [ 0 0 ]
|
||||
|
||||
show_data 1 # 1=on 0=off
|
||||
)
|
||||
|
||||
floorplan
|
||||
(
|
||||
bitmap "maps/cave.png"
|
||||
size [ 16.000 16.000 1.000 ]
|
||||
)
|
||||
|
||||
ant_bot
|
||||
(
|
||||
name "ant_robot_1"
|
||||
pose [ -6.432 -5.895 0 45.000 ]
|
||||
color "green"
|
||||
)
|
||||
|
||||
ant_bot
|
||||
(
|
||||
name "ant_robot_2"
|
||||
pose [ 6.432 -3.895 0 135.000 ]
|
||||
color "green"
|
||||
)
|
||||
|
||||
ant_bot
|
||||
(
|
||||
name "ant_robot_3"
|
||||
pose [ -6.432 5.895 0 -45.000 ]
|
||||
color "green"
|
||||
)
|
||||
|
||||
ant_bot
|
||||
(
|
||||
name "ant_robot_4"
|
||||
pose [ 6.432 5.895 0 -135.000 ]
|
||||
color "green"
|
||||
)
|
17
ant_bot.inc
Normal file
17
ant_bot.inc
Normal file
@@ -0,0 +1,17 @@
|
||||
define ant_bot position
|
||||
(
|
||||
block
|
||||
(
|
||||
points 6
|
||||
point[0] [ 0.75 0 ]
|
||||
point[1] [ 1 0.25 ]
|
||||
point[2] [ 1 0.75 ]
|
||||
point[3] [ 0.75 1 ]
|
||||
point[4] [ 0 1 ]
|
||||
point[5] [ 0 0 ]
|
||||
z [ 0 0.45 ]
|
||||
)
|
||||
|
||||
drive "diff"
|
||||
localization "gps"
|
||||
)
|
79
ias_ss.cpp
Normal file
79
ias_ss.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/*************************************************************************************
|
||||
* Copyright (c) 2016, Miguel Angel Astor Romero *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Redistribution and use in source and binary forms, with or without *
|
||||
* modification, are permitted provided that the following conditions are met: *
|
||||
* *
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this *
|
||||
* list of conditions and the following disclaimer. *
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, *
|
||||
* this list of conditions and the following disclaimer in the documentation *
|
||||
* and/or other materials provided with the distribution. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
*************************************************************************************/
|
||||
|
||||
#include <vector>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <csignal>
|
||||
|
||||
#include "robot.hpp"
|
||||
|
||||
const std::string HOST_NAME = "localhost";
|
||||
const uint32_t PORT = 6666;
|
||||
const uint32_t NUM_ROBOTS = 4;
|
||||
|
||||
extern "C" {
|
||||
void * robot_thread(void * arg) {
|
||||
IASSS_Robot * robot = static_cast<IASSS_Robot *>(arg);
|
||||
|
||||
std::cout << "Running robot thread." << std::endl;
|
||||
robot->run();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
pthread_t robot_threads[NUM_ROBOTS];
|
||||
std::vector<IASSS_Robot *> robots;
|
||||
|
||||
try {
|
||||
// Initialize the robot objects and threads.
|
||||
for(uint32_t i = 0; i < NUM_ROBOTS; ++i) {
|
||||
robots.push_back(new IASSS_Robot(HOST_NAME, PORT + i));
|
||||
|
||||
if(pthread_create(&robot_threads[i], NULL, robot_thread, static_cast<void *>(robots[i])) != 0) {
|
||||
perror("Could not create robot thread");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for all the robots to finish.
|
||||
for(uint32_t i = 0; i < NUM_ROBOTS; ++i) {
|
||||
if(pthread_join(robot_threads[i], NULL) != 0) {
|
||||
perror("Could not join robot thread");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
delete robots[i];
|
||||
}
|
||||
robots.clear();
|
||||
|
||||
} catch (PlayerCc::PlayerError & e) {
|
||||
std::cerr << e << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
11
map.inc
Normal file
11
map.inc
Normal file
@@ -0,0 +1,11 @@
|
||||
define floorplan model
|
||||
(
|
||||
color "gray30"
|
||||
boundary 1
|
||||
gui_nose 0
|
||||
gui_move 0
|
||||
gui_outline 0
|
||||
gripper_return 0
|
||||
fiducial_return 0
|
||||
ranger_return 1
|
||||
)
|
BIN
maps/cave.png
Normal file
BIN
maps/cave.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
23
robot.cpp
Normal file
23
robot.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "robot.hpp"
|
||||
|
||||
Robot::Robot(std::string hostname, uint32_t port) {
|
||||
_p_client = new PlayerCc::PlayerClient(hostname, port);
|
||||
_p_proxy = new PlayerCc::Position2dProxy(_p_client, 0);
|
||||
}
|
||||
|
||||
Robot::~Robot() {
|
||||
delete _p_proxy;
|
||||
delete _p_client;
|
||||
}
|
||||
|
||||
IASSS_Robot::IASSS_Robot(std::string hostname, uint32_t port) : Robot(hostname, port) {
|
||||
std::cout << "Creating IAS-SS robot on host \"" << hostname << "\" and port " << port << "." << std::endl;
|
||||
}
|
||||
|
||||
IASSS_Robot::~IASSS_Robot() {
|
||||
std::cout << "Destroying IAS-SS robot." << std::endl;
|
||||
}
|
||||
|
||||
void IASSS_Robot::run() {
|
||||
sleep(10);
|
||||
}
|
67
robot.hpp
Normal file
67
robot.hpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*************************************************************************************
|
||||
* Copyright (c) 2016, Miguel Angel Astor Romero *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Redistribution and use in source and binary forms, with or without *
|
||||
* modification, are permitted provided that the following conditions are met: *
|
||||
* *
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this *
|
||||
* list of conditions and the following disclaimer. *
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, *
|
||||
* this list of conditions and the following disclaimer in the documentation *
|
||||
* and/or other materials provided with the distribution. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
*************************************************************************************/
|
||||
|
||||
#ifndef ROBOT_HPP
|
||||
#define ROBOT_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <libplayerc++/playerc++.h>
|
||||
|
||||
/**
|
||||
* Base class for robot types.
|
||||
*/
|
||||
class Robot {
|
||||
public:
|
||||
Robot(std::string hostname, uint32_t port);
|
||||
virtual ~Robot();
|
||||
|
||||
virtual void run() = 0;
|
||||
|
||||
protected:
|
||||
PlayerCc::PlayerClient * _p_client;
|
||||
PlayerCc::Position2dProxy * _p_proxy;
|
||||
};
|
||||
|
||||
/**
|
||||
* Concrete robot that implements the IAS-SS architecture as defined in:
|
||||
*
|
||||
* 1) R. Calvo et al. "Inverse ACO for Exploration and Surveillance in
|
||||
* Unknown Environments", The Third International Conference on Advanced
|
||||
* Cognitive Technologies and Applications, Rome, Italy 2011.
|
||||
*
|
||||
* 2) R. Calvo et al. "A Distributed, Bio-Inspired Coordination Strategy
|
||||
* for Multiple Agent Systems Applied to Surveillance Tasks in Unknown
|
||||
* Environments", Proc. of the IEEE IJCNN, San Jose, USA, 2011.
|
||||
*/
|
||||
class IASSS_Robot : Robot{
|
||||
public:
|
||||
IASSS_Robot(std::string hostname, uint32_t port);
|
||||
virtual ~IASSS_Robot();
|
||||
|
||||
virtual void run();
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user