Skip to content

Commit

Permalink
Merge d522c9e into 2f37ef5
Browse files Browse the repository at this point in the history
  • Loading branch information
jansegre committed May 29, 2016
2 parents 2f37ef5 + d522c9e commit 0c3ba5c
Show file tree
Hide file tree
Showing 46 changed files with 3,661 additions and 941 deletions.
2 changes: 2 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ install:
- cargo -vV
build_script:
- cargo build --verbose
- cargo build --verbose --manifest-path cli/Cargo.toml
- cargo build --verbose --manifest-path gui/Cargo.toml
test_script:
- cargo test --verbose
- cargo bench --verbose
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ before_script:
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
script:
- travis-cargo build
- cargo build --verbose --manifest-path cli/Cargo.toml
- cargo build --verbose --manifest-path gui/Cargo.toml
- travis-cargo test
- travis-cargo bench
- travis-cargo --only stable doc
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ default = []
unstable = []

[dependencies]
net2 = "0.2"
time = "0.1"
roboime-next-protocol = { path = "protocol" }
net2 = "0.2"
log = "0.3"
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,15 @@ __Line 1__, command counter:

__Next `ROBOT_COUNT_PLAYER` lines__, robots commands:

- `V_TAN`: a float, robot tangencial velocity
- `V_NORM`: a float, robot normal velocity
- `V_ANG`: a float, robot angular velocity
- `KICK_X`: a float, robot x kick velocity
- `KICK_Z`: a float, robot z kick velocity
- `SPIN`: a bool, true (`1`) if the spin is to be turned or false (`0`) else
- `V_TANGENT`: a float, robot tangencial velocity
- `V_NORMAL`: a float, robot normal velocity
- `V_ANGULAR`: a float, robot angular velocity
- `KICK_FORCE`: a float, robot kick force (currently this is the shooting velocity)
- `CHIP_FORCE`: a float, robot chip kick force, similar to `KICK_FORCE` but is shot at a 45 degrees angle
- `DRIBBLE`: a bool, true (`1`) if the dribbler will be turned on, else (`0`) it will be off

> NOTE: only one of KICK_FORCE, CHIP_FORCE and DRIBBLE will be in effect at any given moment, in the future
> the protocol may be amended to make this more explicit.
These actions will be applied on the robots in the order they were given.

Expand Down
83 changes: 79 additions & 4 deletions cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ doc = false
[dependencies]
roboime-next = { path = ".." }
clap = "^2.4.0"
clock_ticks = "~0.1.0"
log = "0.3"
env_logger = "0.3"
27 changes: 14 additions & 13 deletions cli/demos/c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,26 @@ int main() {
printf("%i\n", counter);

for (int i = 0; i < ids_count; ++i) {
float v_tan = 0.0f;
float v_norm = 0.0f;
float v_ang = 0.0f;
float kick_x = 0.0f;
float kick_z = 0.0f;
int spin = 0;
float v_tangent = 0.0f;
float v_normal = 0.0f;
float v_angular = 0.0f;
float kick_force = 0.0f;
float chip_force = 0.0f;
int dribble = 0;

if (ids[i] == 0) {
const float PL = 0.40f;
const float PW = 0.80f;
v_tan = PL * ((tx - x) * cos(w) + (ty - y) * sin(w));
v_norm = PL * ((ty - y) * cos(w) + (tx - x) * sin(w));
v_ang = PW * (tw - w);
kick_x = 4.0f;
kick_z = 0.0f;
spin = 1;
v_tangent = PL * ((tx - x) * cos(w) + (ty - y) * sin(w));
v_normal = PL * ((ty - y) * cos(w) + (tx - x) * sin(w));
v_angular = PW * (tw - w);
kick_force = 4.0f;
chip_force = 0.0f;
dribble = 1;
}

printf("%f %f %f %f %f %i\n", v_tan, v_norm, v_ang, kick_x, kick_z, spin);
//fprintf(stderr, "%f %f %f %f %f %i\n", v_tangent, v_normal, v_angular, kick_force, chip_force, dribble);
printf("%f %f %f %f %f %i\n", v_tangent, v_normal, v_angular, kick_force, chip_force, dribble);
}

fflush(stdout);
Expand Down
26 changes: 13 additions & 13 deletions cli/demos/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,25 @@ int main() {

for (int i = 0; i < ids.size() ; ++i) {
const int robot_id = ids[i];
float v_tan = 0.0f;
float v_norm = 0.0f;
float v_ang = 0.0f;
float kick_x = 0.0f;
float kick_z = 0.0f;
bool spin = false;
float v_tangent = 0.0f;
float v_normal = 0.0f;
float v_angular = 0.0f;
float kick_force = 0.0f;
float chip_force = 0.0f;
bool dribble = false;

if (robot_id == 0) {
const float PL = 0.40f;
const float PW = 0.80f;
v_tan = PL * ((tx - x) * cos(w) + (ty - y) * sin(w));
v_norm = PL * ((ty - y) * cos(w) + (tx - x) * sin(w));
v_ang = PW * (tw - w);
kick_x = 4.0f;
kick_z = 0.0f;
spin = true;
v_tangent = PL * ((tx - x) * cos(w) + (ty - y) * sin(w));
v_normal = PL * ((ty - y) * cos(w) + (tx - x) * sin(w));
v_angular = PW * (tw - w);
kick_force = 4.0f;
chip_force = 0.0f;
dribble = true;
}

cout << v_tan << " " << v_norm << " " << v_ang << " " << kick_x << " " << kick_z << " " << spin << endl;
cout << v_tangent << " " << v_normal << " " << v_angular << " " << kick_force << " " << chip_force << " " << dribble << endl;
}
}
}
26 changes: 13 additions & 13 deletions cli/demos/lua/demo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,25 @@ while true do
print(counter)

for _, robot_id in ipairs(ids) do
local v_tan = 0
local v_norm = 0
local v_ang = 0
local kick_x = 0
local kick_z = 0
local spin = 0
local v_tangent = 0
local v_normal = 0
local v_angular = 0
local kick_force = 0
local chip_force = 0
local dribble = 0

if robot_id == 0 then
PL = 0.40
PW = 0.80
v_tan = PL * ((tx - x) * math.cos(w) + (ty - y) * math.sin(w))
v_norm = PL * ((ty - y) * math.cos(w) + (tx - x) * math.sin(w))
v_ang = PW * (tw - w)
kick_x = 4.0
kick_z = 0.0
spin = 1
v_tangent = PL * ((tx - x) * math.cos(w) + (ty - y) * math.sin(w))
v_normal = PL * ((ty - y) * math.cos(w) + (tx - x) * math.sin(w))
v_angular = PW * (tw - w)
kick_force = 4.0
chip_force = 0.0
dribble = 1
end

print(table.concat({v_tan, v_norm, v_ang, kick_x, kick_z, spin}), " ")
print(table.concat({v_tangent, v_normal, v_angular, kick_force, chip_force, dribble}), " ")
end

io.stdout:flush()
Expand Down
28 changes: 14 additions & 14 deletions cli/demos/python2/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,23 @@
print counter

for robot_id in ids:
v_tan = 0.0
v_norm = 0.0
v_ang = 0.0
kick_x = 0.0
kick_z = 0.0
spin = 0
v_tangent = 0.0
v_normal = 0.0
v_angular = 0.0
kick_force = 0.0
chip_force = 0.0
dribble = 0

if robot_id == 0:
PL = 0.40
PW = 0.80
v_tan = PL * ((tx - x) * cos(w) + (ty - y) * sin(w))
v_norm = PL * ((ty - y) * cos(w) - (tx - x) * sin(w))
v_ang = PW * (tw - w)
kick_x = 4.0
kick_z = 0.0
spin = 1

print v_tan, v_norm, v_ang, kick_x, kick_z, spin
v_tangent = PL * ((tx - x) * cos(w) + (ty - y) * sin(w))
v_normal = PL * ((ty - y) * cos(w) - (tx - x) * sin(w))
v_angular = PW * (tw - w)
kick_force = 4.0
chip_force = 0.0
dribble = 1

print v_tangent, v_normal, v_angular, kick_force, chip_force, dribble

sys.stdout.flush()
28 changes: 14 additions & 14 deletions cli/demos/python3/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@
print(counter)

for robot_id in ids:
v_tan = 0.0
v_norm = 0.0
v_ang = 0.0
kick_x = 0.0
kick_z = 0.0
spin = 0
v_tangent = 0.0
v_normal = 0.0
v_angular = 0.0
kick_force = 0.0
chip_force = 0.0
dribble = 0

if robot_id == 0:
PL = 0.40
PW = 0.80
v_tan = PL * ((tx - x) * cos(w) + (ty - y) * sin(w))
v_norm = PL * ((ty - y) * cos(w) - (tx - x) * sin(w))
v_ang = PW * (tw - w)
kick_x = 4.0
kick_z = 0.0
spin = 1

print(v_tan, v_norm, v_ang, kick_x, kick_z, spin)
v_tangent = PL * ((tx - x) * cos(w) + (ty - y) * sin(w))
v_normal = PL * ((ty - y) * cos(w) - (tx - x) * sin(w))
v_angular = PW * (tw - w)
kick_force = 4.0
chip_force = 0.0
dribble = 1

print(v_tangent, v_normal, v_angular, kick_force, chip_force, dribble)

0 comments on commit 0c3ba5c

Please sign in to comment.