-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
642 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,4 +59,9 @@ a { | |
|
||
button:focus { | ||
outline:0; | ||
} | ||
|
||
.rotation-indicator { | ||
stroke: #888; | ||
stroke-width:1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
This page intentionally left blank | ||
Note, if you want to copy these examples to your own directory and compile them, you may need to change `src/Makefile` as follows: | ||
|
||
```make | ||
ENVIRODIR := ../../../server/include | ||
``` | ||
|
||
should read | ||
|
||
```make | ||
ENVIRODIR := /usr/local/src/enviro/server/include | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
TARGET := bin/enviro | ||
|
||
all: | ||
$(MAKE) -C src all | ||
|
||
clean: | ||
$(MAKE) -C src clean | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
|
||
"name": "Omni Demo. Click and/or press w, s, a or d", | ||
"ip": "0.0.0.0", | ||
"port": 8765, | ||
|
||
"agents": [ | ||
{ | ||
"definition": "defs/player.json", | ||
"style": { "fill": "lightgreen", "stroke": "black" }, | ||
"position": { | ||
"x": 0, | ||
"y": 0, | ||
"theta": 0 | ||
} | ||
}, | ||
{ | ||
"definition": "defs/mover.json", | ||
"style": { "fill": "lightblue", "stroke": "black" }, | ||
"position": { | ||
"x": 100, | ||
"y": 0, | ||
"theta": 0 | ||
} | ||
}, | ||
{ | ||
"definition": "defs/tracker.json", | ||
"style": { "fill": "red", "stroke": "black" }, | ||
"position": { | ||
"x": -100, | ||
"y": -46, | ||
"theta": 0 | ||
} | ||
} | ||
], | ||
|
||
"statics": [ | ||
{ | ||
"style": { "fill": "gray", "stroke": "none" }, | ||
"shape": [ | ||
{ "x": -350, "y": -200 }, | ||
{ "x": -350, "y": 200 }, | ||
{ "x": -340, "y": 200 }, | ||
{ "x": -340, "y": -200 } | ||
] | ||
}, | ||
{ | ||
"style": { "fill": "gray", "stroke": "none" }, | ||
"shape": [ | ||
{ "x": 350, "y": -200 }, | ||
{ "x": 350, "y": 200 }, | ||
{ "x": 340, "y": 200 }, | ||
{ "x": 340, "y": -200 } | ||
] | ||
}, | ||
{ | ||
"style": { "fill": "gray", "stroke": "none" }, | ||
"shape": [ | ||
{ "x": -350, "y": 200 }, | ||
{ "x": 350, "y": 200 }, | ||
{ "x": 350, "y": 190 }, | ||
{ "x": -350, "y": 190 } | ||
] | ||
}, | ||
{ | ||
"style": { "fill": "gray", "stroke": "none" }, | ||
"shape": [ | ||
{ "x": -350, "y": -200 }, | ||
{ "x": 350, "y": -200 }, | ||
{ "x": 350, "y": -190 }, | ||
{ "x": -350, "y": -190 } | ||
] | ||
} | ||
|
||
] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Put agent definitions in this folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Mover", | ||
"type": "dynamic", | ||
"description": "Replace this string with a description", | ||
"shape": "omni", | ||
"radius": 10, | ||
"friction": { | ||
"collision": 1, | ||
"linear": 1, | ||
"rotational": 600 | ||
}, | ||
"sensors": [], | ||
"mass": 1, | ||
"controller": "lib/mover.so" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "Player", | ||
"type": "dynamic", | ||
"description": "Replace this string with a description", | ||
"shape": "omni", | ||
"radius": 20, | ||
"friction": { | ||
"collision": 1, | ||
"linear": 1, | ||
"rotational": 1000 | ||
}, | ||
"sensors": [ | ||
{ | ||
"type": "range", | ||
"location": { "x": 20, "y": 0 }, | ||
"direction": 0 | ||
} | ||
], | ||
"mass": 1, | ||
"controller": "lib/player.so" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Tracker", | ||
"type": "dynamic", | ||
"description": "Replace this string with a description", | ||
"shape": "omni", | ||
"radius": 5, | ||
"friction": { | ||
"collision": 5, | ||
"linear": 40, | ||
"rotational": 600 | ||
}, | ||
"sensors": [], | ||
"mass": 1, | ||
"controller": "lib/tracker.so" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Shared object libraries will be place here by make. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#Architecture | ||
ARCH := $(shell uname -m) | ||
|
||
#Compilers | ||
CC := g++ -std=c++17 -Wno-psabi | ||
|
||
#The Target Library | ||
|
||
#The Directories, Source, Includes, Objects, Binary and Resources | ||
SRCEXT := cc | ||
|
||
# Directories | ||
CHIPDIR := /usr/local/src/Chipmunk2D | ||
ENVIRODIR := ../../../server/include | ||
|
||
#Flags, Libraries and Includes | ||
CFLAGS := -ggdb -shared -fPIC | ||
INCLUDE := -I $(ENVIRODIR) -I $(CHIPDIR)/include/chipmunk | ||
|
||
#Files | ||
|
||
TARGETDIR := ../lib | ||
SOURCES := $(wildcard *.cc) | ||
HEADERS := $(wildcard *.h) | ||
TARGETS := $(patsubst %.cc,%.so,$(wildcard *.cc)) | ||
FULL_TARGETS := $(addprefix $(TARGETDIR)/, $(TARGETS)) | ||
|
||
#Default Make | ||
all: $(FULL_TARGETS) | ||
|
||
#Clean only Objects | ||
clean: | ||
@$(RM) -rf $(TARGETDIR)/*.so | ||
|
||
# Compile | ||
$(TARGETDIR)/%.so: %.cc %.h | ||
$(CC) $(CFLAGS) $(INCLUDE) $< -o $@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <iostream> | ||
#include "mover.h" | ||
|
||
using namespace enviro; | ||
|
||
// Put your implementations here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef __MOVER_AGENT__H | ||
#define __MOVER_AGENT__H | ||
|
||
#include "enviro.h" | ||
#include <math.h> | ||
|
||
using namespace enviro; | ||
|
||
class MoverController : public Process, public AgentInterface { | ||
|
||
public: | ||
MoverController() : Process(), AgentInterface() {} | ||
|
||
void init() {} | ||
void start() { | ||
i = 0; | ||
t = 0; | ||
} | ||
void update() { | ||
t += 1; | ||
if ( t > 40 ) { | ||
t = 0; | ||
i = (i+1)%4; | ||
} | ||
omni_track_velocity(5*vx[i], 5*vy[i]); | ||
} | ||
void stop() {} | ||
|
||
int t; | ||
const vector<double> vx = { 1, 0, -1, 0 }; | ||
const vector<double> vy = { 0, 1, 0, -1 }; | ||
int i; | ||
|
||
}; | ||
|
||
class Mover : public Agent { | ||
public: | ||
Mover(json spec, World& world) : Agent(spec, world) { | ||
add_process(c); | ||
} | ||
private: | ||
MoverController c; | ||
}; | ||
|
||
DECLARE_INTERFACE(Mover) | ||
|
||
#endif |
Oops, something went wrong.