code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
from scripts.commons.Script import Script
script = Script(cpp_builder_unum=1) # Initialize: load config file, parse arguments, build cpp modules
a = script.args
if a.P: # penalty shootout
from agent.Agent_Penalty import Agent
else: # normal agent
from agent.Agent import Agent
# Args: Server IP, Agent Port, Mo... | 2302_81918214/robocup3D | FCPCodebase-main/Run_Player.py | Python | agpl-3.0 | 648 |
def main():
from scripts.commons.Script import Script
script = Script() #Initialize: load config file, parse arguments, build cpp modules (warns the user about inconsistencies before choosing a test script)
# Allows using local version of StableBaselines3 (e.g. https://github.com/m-abr/Adaptive-Symmetry-L... | 2302_81918214/robocup3D | FCPCodebase-main/Run_Utils.py | Python | agpl-3.0 | 4,496 |
from agent.Base_Agent import Base_Agent
from math_ops.Math_Ops import Math_Ops as M
import math
import numpy as np
class Agent(Base_Agent):
def __init__(self, host:str, agent_port:int, monitor_port:int, unum:int,
team_name:str, enable_log, enable_draw, wait_for_server=True, is_fat_proxy=Fals... | 2302_81918214/robocup3D | FCPCodebase-main/agent/Agent.py | Python | agpl-3.0 | 13,899 |
from agent.Base_Agent import Base_Agent
from math_ops.Math_Ops import Math_Ops as M
import numpy as np
import random
class Agent(Base_Agent):
def __init__(self, host:str, agent_port:int, monitor_port:int, unum:int,
team_name:str, enable_log, enable_draw, wait_for_server=True, is_fat_proxy=False) ... | 2302_81918214/robocup3D | FCPCodebase-main/agent/Agent_Penalty.py | Python | agpl-3.0 | 4,371 |
from abc import abstractmethod
from behaviors.Behavior import Behavior
from communication.Radio import Radio
from communication.Server_Comm import Server_Comm
from communication.World_Parser import World_Parser
from logs.Logger import Logger
from math_ops.Inverse_Kinematics import Inverse_Kinematics
from world.commons.... | 2302_81918214/robocup3D | FCPCodebase-main/agent/Base_Agent.py | Python | agpl-3.0 | 2,203 |
import numpy as np
class Behavior():
def __init__(self, base_agent) -> None:
from agent.Base_Agent import Base_Agent # for type hinting
self.base_agent : Base_Agent = base_agent
self.world = self.base_agent.world
self.state_behavior_name = None
self.state_behavior_init_ms ... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/Behavior.py | Python | agpl-3.0 | 7,213 |
from math_ops.Math_Ops import Math_Ops as M
from world.World import World
import numpy as np
class Head():
FIELD_FLAGS = World.FLAGS_CORNERS_POS + World.FLAGS_POSTS_POS
HEAD_PITCH = -35
def __init__(self, world : World) -> None:
self.world = world
self.look_left = True
self.state =... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/Head.py | Python | agpl-3.0 | 4,730 |
'''
Pose - angles in degrees for the specified joints
Note: toes positions are ignored by robots that have no toes
Poses may control all joints or just a subgroup defined by the "indices" variable
'''
import numpy as np
from world.World import World
class Poses():
def __init__(self, world : World) -> None:
... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/Poses.py | Python | agpl-3.0 | 4,396 |
from math_ops.Math_Ops import Math_Ops as M
from os import listdir
from os.path import isfile, join
from world.World import World
import numpy as np
import xml.etree.ElementTree as xmlp
class Slot_Engine():
def __init__(self, world : World) -> None:
self.world = world
self.state_slot_number = 0
... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/Slot_Engine.py | Python | agpl-3.0 | 4,737 |
from agent.Base_Agent import Base_Agent
from behaviors.custom.Step.Step_Generator import Step_Generator
from math_ops.Math_Ops import Math_Ops as M
class Basic_Kick():
def __init__(self, base_agent : Base_Agent) -> None:
self.behavior = base_agent.behavior
self.path_manager = base_agent.path_mana... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Basic_Kick/Basic_Kick.py | Python | agpl-3.0 | 3,874 |
from agent.Base_Agent import Base_Agent
from behaviors.custom.Dribble.Env import Env
from math_ops.Math_Ops import Math_Ops as M
from math_ops.Neural_Network import run_mlp
import numpy as np
import pickle
class Dribble():
def __init__(self, base_agent : Base_Agent) -> None:
self.behavior = base_agent.be... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Dribble/Dribble.py | Python | agpl-3.0 | 9,453 |
from agent.Base_Agent import Base_Agent
from behaviors.custom.Step.Step_Generator import Step_Generator
from math_ops.Math_Ops import Math_Ops as M
import math
import numpy as np
class Env():
def __init__(self, base_agent : Base_Agent, step_width) -> None:
self.world = base_agent.world
self.ik = b... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Dribble/Env.py | Python | agpl-3.0 | 7,861 |
from agent.Base_Agent import Base_Agent
from math_ops.Math_Ops import Math_Ops as M
from math_ops.Neural_Network import run_mlp
import pickle, numpy as np
class Fall():
def __init__(self, base_agent : Base_Agent) -> None:
self.world = base_agent.world
self.description = "Fall example"
self... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Fall/Fall.py | Python | agpl-3.0 | 1,802 |
from agent.Base_Agent import Base_Agent
from collections import deque
import numpy as np
class Get_Up():
def __init__(self, base_agent : Base_Agent) -> None:
self.behavior = base_agent.behavior
self.world = base_agent.world
self.description = "Get Up using the most appropriate skills"
... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Get_Up/Get_Up.py | Python | agpl-3.0 | 2,819 |
from agent.Base_Agent import Base_Agent
from behaviors.custom.Step.Step_Generator import Step_Generator
import numpy as np
class Step():
def __init__(self, base_agent : Base_Agent) -> None:
self.world = base_agent.world
self.ik = base_agent.inv_kinematics
self.description = "Step (Skill-Se... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Step/Step.py | Python | agpl-3.0 | 2,218 |
import math
class Step_Generator():
GRAVITY = 9.81
Z0 = 0.2
def __init__(self, feet_y_dev, sample_time, max_ankle_z) -> None:
self.feet_y_dev = feet_y_dev
self.sample_time = sample_time
self.state_is_left_active = False
self.state_current_ts = 0
self.switch = F... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Step/Step_Generator.py | Python | agpl-3.0 | 2,984 |
from agent.Base_Agent import Base_Agent
from behaviors.custom.Step.Step_Generator import Step_Generator
from math_ops.Math_Ops import Math_Ops as M
import math
import numpy as np
class Env():
def __init__(self, base_agent : Base_Agent) -> None:
self.world = base_agent.world
self.ik = base_agent.i... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Walk/Env.py | Python | agpl-3.0 | 9,035 |
from agent.Base_Agent import Base_Agent
from behaviors.custom.Walk.Env import Env
from math_ops.Math_Ops import Math_Ops as M
from math_ops.Neural_Network import run_mlp
import numpy as np
import pickle
class Walk():
def __init__(self, base_agent : Base_Agent) -> None:
self.world = base_agent.world
... | 2302_81918214/robocup3D | FCPCodebase-main/behaviors/custom/Walk/Walk.py | Python | agpl-3.0 | 3,399 |
#!/bin/bash
# Call this script from any directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# cd to main folder
cd "${SCRIPT_DIR}/.."
rm -rf ./bundle/build
rm -rf ./bundle/dist
onefile="--onefile"
# bundle app, dependencies and data files into single executable
pyinstaller \
--ad... | 2302_81918214/robocup3D | FCPCodebase-main/bundle/bundle.sh | Shell | agpl-3.0 | 1,957 |
from typing import List
from world.commons.Other_Robot import Other_Robot
from world.World import World
import numpy as np
class Radio():
'''
map limits are hardcoded:
teammates/opponents positions (x,y) in ([-16,16],[-11,11])
ball position (x,y) in ([-15,15],[-10,10])
known server limitati... | 2302_81918214/robocup3D | FCPCodebase-main/communication/Radio.py | Python | agpl-3.0 | 15,117 |
from communication.World_Parser import World_Parser
from itertools import count
from select import select
from sys import exit
from world.World import World
import socket
import time
class Server_Comm():
monitor_socket = None
def __init__(self, host:str, agent_port:int, monitor_port:int, unum:int, robot_type:... | 2302_81918214/robocup3D | FCPCodebase-main/communication/Server_Comm.py | Python | agpl-3.0 | 11,585 |
from math_ops.Math_Ops import Math_Ops as M
from world.Robot import Robot
from world.World import World
import math
import numpy as np
class World_Parser():
def __init__(self, world:World, hear_callback) -> None:
self.LOG_PREFIX = "World_Parser.py: "
self.world = world
self.hear_callback =... | 2302_81918214/robocup3D | FCPCodebase-main/communication/World_Parser.py | Python | agpl-3.0 | 22,136 |
src = $(wildcard *.cpp)
obj = $(src:.c=.o)
CFLAGS = -O3 -shared -std=c++11 -fPIC -Wall $(PYBIND_INCLUDES)
all: $(obj)
g++ $(CFLAGS) -o a_star.so $^
debug: $(filter-out lib_main.cpp,$(obj))
g++ -O0 -std=c++14 -Wall -g -o debug.bin debug_main.cc $^
.PHONY: clean
clean:
rm -f $(obj) all
| 2302_81918214/robocup3D | FCPCodebase-main/cpp/a_star/Makefile | Makefile | agpl-3.0 | 292 |
#include "a_star.h"
#include "expansion_groups.h"
#include <cmath>
#include <algorithm>
#include <chrono>
#define SQRT2 1.414213562373095f
#define LINES 321
#define COLS 221
#define MAX_RADIUS 5 // obstacle max radius in meters
#define IN_GOAL_LINE 312 // target line when go_to_goal is 'true' (312 -> 15.2m)
using std:... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/a_star/a_star.cpp | C++ | agpl-3.0 | 36,022 |
#pragma once
/**
* FILENAME: a_star.h
* DESCRIPTION: custom A* pathfinding implementation, optimized for the soccer environment
* AUTHOR: Miguel Abreu (m.abreu@fe.up.pt)
* DATE: 2022
*/
struct Node{
//------------- BST parameters
Node* left;
Node* right;
Node* up;
//-----... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/a_star/a_star.h | C | agpl-3.0 | 503 |
#include "a_star.h"
#include <chrono>
#include <iostream>
using std::chrono::high_resolution_clock;
using std::chrono::duration_cast;
using std::chrono::microseconds;
std::chrono::_V2::system_clock::time_point t1,t2;
float params[] = {
15.78,-0.07, //start
1,1, //out of bounds? go to goal?
0,0, //target ... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/a_star/debug_main.cc | C++ | agpl-3.0 | 885 |
const int expansion_positions_no = 7845;
const float expansion_pos_dist[7845] = {0.0,0.1,0.1,0.1,0.1,0.14142135623730953,0.14142135623730953,0.14142135623730953,0.14142135623730953,0.2,0.2,0.2,0.2,0.223606797749979,0.223606797749979,0.223606797749979,0.223606797749979,0.223606797749979,0.223606797749979,0.2236067977499... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/a_star/expansion_groups.h | C | agpl-3.0 | 191,723 |
from os import getcwd
from os.path import join, dirname
from math import sqrt
MAX_RADIUS = 5
LINES = 321
COLS = 221
expansion_groups = dict()
CWD = join(getcwd(), dirname(__file__))
for l in range(MAX_RADIUS*10+1):
for c in range(MAX_RADIUS*10+1):
dist = sqrt(l*l+c*c)*0.1
if dist <= MAX_RADIUS:
... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/a_star/expansion_groups.py | Python | agpl-3.0 | 1,646 |
#include "a_star.h"
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
namespace py = pybind11;
using namespace std;
py::array_t<float> compute( py::array_t<float> parameters ){
// ================================================= 1. Parse data
py::buffer_info parameters_buf = parameters.reques... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/a_star/lib_main.cpp | C++ | agpl-3.0 | 1,231 |
src = $(wildcard *.cpp)
obj = $(src:.c=.o)
CFLAGS = -O3 -shared -std=c++11 -fPIC -Wall $(PYBIND_INCLUDES)
all: $(obj)
g++ $(CFLAGS) -o ball_predictor.so $^
debug: $(filter-out lib_main.cpp,$(obj))
g++ -O0 -std=c++14 -Wall -g -o debug.bin debug_main.cc $^
.PHONY: clean
clean:
rm -f $(obj) all
| 2302_81918214/robocup3D | FCPCodebase-main/cpp/ball_predictor/Makefile | Makefile | agpl-3.0 | 300 |
#include <cmath>
#include "ball_predictor.h"
float ball_pos_pred[600]; // ball position (x,y) prediction for 300*0.02s = 6s
float ball_vel_pred[600]; // ball velocity (x,y) prediction for 300*0.02s = 6s
float ball_spd_pred[300]; // ball linear speed (s) prediction for 300*0.02s = 6s
int pos_pred_len=0;
/**
*... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/ball_predictor/ball_predictor.cpp | C++ | agpl-3.0 | 3,659 |
#pragma once
extern float ball_pos_pred[600]; // ball position (x,y) prediction for 300*0.02s = 6s
extern float ball_vel_pred[600]; // ball velocoty (x,y) prediction for 300*0.02s = 6s
extern float ball_spd_pred[300]; // ball linear speed (s) prediction for 300*0.02s = 6s
extern int pos_pred_len;
extern void g... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/ball_predictor/ball_predictor.h | C | agpl-3.0 | 603 |
#include "ball_predictor.h"
#include <chrono>
#include <iostream>
#include <iomanip>
using std::cout;
using std::chrono::high_resolution_clock;
using std::chrono::duration_cast;
using std::chrono::microseconds;
std::chrono::_V2::system_clock::time_point t1,t2;
int main(){
// ====================================... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/ball_predictor/debug_main.cc | C++ | agpl-3.0 | 1,715 |
#include "ball_predictor.h"
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
namespace py = pybind11;
using namespace std;
/**
* @brief Predict rolling ball position, velocity, linear speed
*
* @param parameters
* ball_x, ball_y, ball_vel_x, ball_vel_y
* @return ball_pos_pred, ball_vel_pred, ... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/ball_predictor/lib_main.cpp | C++ | agpl-3.0 | 3,148 |
#include "Field.h"
#include "RobovizLogger.h"
#include "World.h"
static World& world = SWorld::getInstance();
//=================================================================================================
//=========================================================================== constexpr definitions
//=====... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Field.cpp | C++ | agpl-3.0 | 22,994 |
/**
* FILENAME: Field
* DESCRIPTION: Field map
* AUTHOR: Miguel Abreu (m.abreu@fe.up.pt)
* DATE: 2021
*/
#pragma once
#include "Vector3f.h"
#include "Singleton.h"
#include "Matrix4D.h"
#include "Line6f.h"
#include <vector>
#include <array>
using namespace std;
class Field {
friend class ... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Field.h | C++ | agpl-3.0 | 22,552 |
#include "FieldNoise.h"
double FieldNoise::log_prob_r(double d, double r){
double c1 = 100.0 * ((r-0.005)/d - 1);
double c2 = 100.0 * ((r+0.005)/d - 1);
return log_prob_normal_distribution(0, 0.0965, c1, c2);
}
double FieldNoise::log_prob_h(double h, double phi){
double c1 = phi - 0.005 - h;
doubl... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/FieldNoise.cpp | C++ | agpl-3.0 | 4,219 |
/**
* FILENAME: FieldNoise
* DESCRIPTION: efficient computation of relative probabilities (for the noise model of the RoboCup 3DSSL)
* AUTHOR: Miguel Abreu (m.abreu@fe.up.pt)
* DATE: 2021
*/
#pragma once
#include "math.h"
class FieldNoise{
public:
/**
* Log probability of... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/FieldNoise.h | C++ | agpl-3.0 | 3,837 |
#include "Geometry.h"
/**
* This function returns the cosine of a given angle in degrees using the
* built-in cosine function that works with angles in radians.
*
* @param x an angle in degrees
* @return the cosine of the given angle
*/
float Cos(float x) {
return ( cos(x * M_PI / 180));
}
/**
* This func... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Geometry.cpp | C++ | agpl-3.0 | 12,187 |
#ifndef GEOMETRY_H
#define GEOMETRY_H
#include <cmath>
#include <algorithm>
using namespace std;
#define EPSILON 1e-10
/**
* Useful functions to operate with angles in degrees
*/
float Cos(float x);
float Sin(float x);
float ATan2(float x, float y);
/**
* @class Vector
*
* @brief This class represents a ... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Geometry.h | C++ | agpl-3.0 | 1,768 |
#include "Line6f.h"
Line6f::Line6f(const Vector3f &polar_s, const Vector3f &polar_e) :
startp(polar_s), endp(polar_e), startc(polar_s.toCartesian()), endc(polar_e.toCartesian()), length(startc.dist(endc)) {};
Line6f::Line6f(const Vector3f &cart_s, const Vector3f &cart_e, float length) :
startp(cart_s.toPol... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Line6f.cpp | C++ | agpl-3.0 | 7,101 |
/**
* FILENAME: Line6f
* DESCRIPTION: Simple line (segment) class
* AUTHOR: Miguel Abreu (m.abreu@fe.up.pt)
* DATE: 2021
*
* Immutable Class for:
* 3D Line composed of 2 Vector3f points
* Optimized for:
* - regular access to cartesian coordinates
* - regular access to line segment length
... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Line6f.h | C++ | agpl-3.0 | 5,142 |
#include "LocalizerV2.h"
#include "math.h"
#include "iostream"
#include "World.h"
using namespace std;
static World& world = SWorld::getInstance();
/**
* Compute 3D position and 3D orientation
* */
void LocalizerV2::run(){
Field& fd = SField::getInstance();
stats_change_state(RUNNING);
//------------------... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/LocalizerV2.cpp | C++ | agpl-3.0 | 44,661 |
/**
* FILENAME: LocalizerV2
* DESCRIPTION: main 6D localization algorithm
* AUTHOR: Miguel Abreu (m.abreu@fe.up.pt)
* DATE: 2021
*
* ===================================================================================
* WORKFLOW
* ==============================================================... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/LocalizerV2.h | C++ | agpl-3.0 | 19,470 |
src = $(wildcard *.cpp)
obj = $(src:.c=.o)
LDFLAGS = -lgsl -lgslcblas
CFLAGS = -O3 -shared -std=c++11 -fPIC -Wall $(PYBIND_INCLUDES)
all: $(obj)
g++ $(CFLAGS) -o localization.so $^ $(LDFLAGS)
debug: $(filter-out lib_main.cpp,$(obj))
g++ -O0 -std=c++14 -Wall -g -o debug.bin debug_main.cc $^ $(LDFLAGS)
.PHONY: cle... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Makefile | Makefile | agpl-3.0 | 348 |
#include "Matrix4D.h"
Matrix4D::Matrix4D() {
// identity matrix
const float tmp[M_LENGTH] = {
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
for (int i = 0; i < M_LENGTH; i++)
content[i] = tmp[i];
}
Matrix4D::Matrix4D(const float a[M_LENGTH]) {
// crea... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Matrix4D.cpp | C++ | agpl-3.0 | 9,664 |
#ifndef MATRIX4D_H_
#define MATRIX4D_H_
#include "Vector3f.h"
#define M_ROWS 4
#define M_COLS 4
#define M_LENGTH (M_ROWS * M_COLS)
/**
* @class Matrix4D
*
* This class represents a 4x4 matrix and contains methods
* to operate on it
*
* @author Nuno Almeida (nuno.alm@ua.pt)
* Adapted - Miguel Abre... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Matrix4D.h | C++ | agpl-3.0 | 5,024 |
#include <iostream>
#include "RobovizLogger.h"
#include "robovizdraw.h"
#define ROBOVIZ_HOST "localhost"
#define ROBOVIZ_PORT "32769"
RobovizLogger* RobovizLogger::Instance() {
static RobovizLogger instance;
return &instance;
}
RobovizLogger::RobovizLogger() {}
RobovizLogger::~RobovizLogger() {
destroy... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/RobovizLogger.cpp | C++ | agpl-3.0 | 3,779 |
/*
* RobovizLogger.h
*
* Created on: 2013/06/24
* Author: Rui Ferreira
*/
#ifndef _ROBOVIZLOGGER_H_
#define _ROBOVIZLOGGER_H_
#define RobovizLoggerInstance RobovizLogger::Instance()
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string>
#include <sys/types.h>
#include <sys/socket.h>
#inclu... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/RobovizLogger.h | C++ | agpl-3.0 | 1,682 |
#ifndef SINGLETON_H
#define SINGLETON_H
template <class T>
class Singleton {
public:
static T& getInstance() {
static T instance;
return instance;
}
private:
Singleton();
~Singleton();
Singleton(Singleton const&);
Singleton& operator=(Singleton const&);
};
#endif // SINGLET... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Singleton.h | C++ | agpl-3.0 | 325 |
#include "Vector3f.h"
using namespace std;
Vector3f::Vector3f() {
x = 0.0;
y = 0.0;
z = 0.0;
}
Vector3f::Vector3f(float x, float y, float z) {
this->x = x;
this->y = y;
this->z = z;
}
Vector3f::Vector3f(const Vector3f& other) {
x = other.x;
y = other.y;
z = other.z;
}
Vector3f:... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Vector3f.cpp | C++ | agpl-3.0 | 3,892 |
#ifndef VECTOR3F_H
#define VECTOR3F_H
#include <cmath>
#include "Geometry.h"
#include <math.h>
//! Describes a vector of three floats
/*!
* \author Hugo Picado (hugopicado@ua.pt)
* \author Nuno Almeida (nuno.alm@ua.pt)
* Adapted - Miguel Abreu
*/
class Vector3f {
public:
//! Default constructor
Vector3f()... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/Vector3f.h | C++ | agpl-3.0 | 4,320 |
/**
* FILENAME: World
* DESCRIPTION: World data from Python
* AUTHOR: Miguel Abreu (m.abreu@fe.up.pt)
* DATE: 2021
*/
#pragma once
#include "Vector3f.h"
#include "Singleton.h"
#include "Matrix4D.h"
#include "Line6f.h"
#include <vector>
#include <array>
using namespace std;
class World {
... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/World.h | C++ | agpl-3.0 | 1,067 |
#include <iostream>
#include "Geometry.h"
#include "Vector3f.h"
#include "Matrix4D.h"
#include "FieldNoise.h"
#include "Line6f.h"
#include "World.h"
#include "Field.h"
#include "LocalizerV2.h"
using namespace std;
static LocalizerV2& loc = SLocalizerV2::getInstance();
void print_python_data(){
static World &wor... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/debug_main.cc | C++ | agpl-3.0 | 7,957 |
#include <iostream>
#include "Geometry.h"
#include "Vector3f.h"
#include "Matrix4D.h"
#include "FieldNoise.h"
#include "Line6f.h"
#include "World.h"
#include "Field.h"
#include "LocalizerV2.h"
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
namespace py = pybind11;
using namespace std;
static LocalizerV2& ... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/lib_main.cpp | C++ | agpl-3.0 | 6,887 |
/*
* Copyright (C) 2011 Justin Stoecker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... | 2302_81918214/robocup3D | FCPCodebase-main/cpp/localization/robovizdraw.h | C++ | agpl-3.0 | 6,427 |
#!/bin/bash
pkill -9 -e -f "python3 ./Run_"
| 2302_81918214/robocup3D | FCPCodebase-main/kill.sh | Shell | agpl-3.0 | 44 |
from pathlib import Path
from datetime import datetime
import random
from string import ascii_uppercase
class Logger():
_folder = None
def __init__(self, is_enabled:bool, topic:str) -> None:
self.no_of_entries = 0
self.enabled = is_enabled
self.topic = topic
def write(self, msg:s... | 2302_81918214/robocup3D | FCPCodebase-main/logs/Logger.py | Python | agpl-3.0 | 1,713 |
from math import asin, atan, atan2, pi, sqrt
from math_ops.Matrix_3x3 import Matrix_3x3
from math_ops.Math_Ops import Math_Ops as M
import numpy as np
class Inverse_Kinematics():
# leg y deviation, upper leg height, upper leg depth, lower leg length, knee extra angle, max ankle z
NAO_SPECS_PER_ROBOT = ((0.055... | 2302_81918214/robocup3D | FCPCodebase-main/math_ops/Inverse_Kinematics.py | Python | agpl-3.0 | 10,887 |
from math import acos, asin, atan2, cos, pi, sin, sqrt
import numpy as np
import sys
try:
GLOBAL_DIR = sys._MEIPASS # temporary folder with libs & data files
except:
GLOBAL_DIR = "."
class Math_Ops():
'''
This class provides general mathematical operations that are not directly available through nump... | 2302_81918214/robocup3D | FCPCodebase-main/math_ops/Math_Ops.py | Python | agpl-3.0 | 13,674 |
from math import asin, atan2, pi, sqrt
import numpy as np
class Matrix_3x3():
def __init__(self, matrix = None) -> None:
'''
Constructor examples:
a = Matrix_3x3( ) # create identity matrix
b = Matrix_3x3( [[1,1,1],[2,2,2],[3,3,3]] ) # manually initialize ... | 2302_81918214/robocup3D | FCPCodebase-main/math_ops/Matrix_3x3.py | Python | agpl-3.0 | 11,408 |
from math import asin, atan2, pi, sqrt
from math_ops.Math_Ops import Math_Ops as M
from math_ops.Matrix_3x3 import Matrix_3x3
import numpy as np
class Matrix_4x4():
def __init__(self, matrix = None) -> None:
'''
Constructor examples:
a = Matrix_4x4( ) ... | 2302_81918214/robocup3D | FCPCodebase-main/math_ops/Matrix_4x4.py | Python | agpl-3.0 | 14,338 |
import numpy as np
def run_mlp(obs, weights, activation_function="tanh"):
'''
Run multilayer perceptron using numpy
Parameters
----------
obs : ndarray
float32 array with neural network inputs
weights : list
list of MLP layers of type (bias, kernel)
activation_functio... | 2302_81918214/robocup3D | FCPCodebase-main/math_ops/Neural_Network.py | Python | agpl-3.0 | 798 |
from os import path, listdir, getcwd, cpu_count
from os.path import join, realpath, dirname, isfile, isdir, getmtime
from scripts.commons.UI import UI
import __main__
import argparse,json,sys
import pickle
import subprocess
class Script():
ROOT_DIR = path.dirname(path.dirname(realpath( join(getcwd(), dirname(__fi... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/commons/Script.py | Python | agpl-3.0 | 12,715 |
import subprocess
class Server():
def __init__(self, first_server_p, first_monitor_p, n_servers) -> None:
try:
import psutil
self.check_running_servers(psutil, first_server_p, first_monitor_p, n_servers)
except ModuleNotFoundError:
print("Info: Cannot check if th... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/commons/Server.py | Python | agpl-3.0 | 2,704 |
from datetime import datetime, timedelta
from itertools import count
from os import listdir
from os.path import isdir, join, isfile
from scripts.commons.UI import UI
from shutil import copy
from stable_baselines3 import PPO
from stable_baselines3.common.base_class import BaseAlgorithm
from stable_baselines3.common.call... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/commons/Train_Base.py | Python | agpl-3.0 | 20,033 |
from itertools import zip_longest
from math import inf
import math
import numpy as np
import shutil
class UI():
console_width = 80
console_height = 24
@staticmethod
def read_particle(prompt, str_options, dtype=str, interval=[-inf,inf]):
'''
Read particle from user from a given dty... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/commons/UI.py | Python | agpl-3.0 | 12,182 |
from agent.Base_Agent import Base_Agent as Agent
from behaviors.custom.Step.Step import Step
from world.commons.Draw import Draw
from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import SubprocVecEnv
from scripts.commons.Server import Server
from scripts.commons.Train_Base import Train_Base
from t... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/gyms/Basic_Run.py | Python | agpl-3.0 | 11,861 |
from agent.Base_Agent import Base_Agent as Agent
from world.commons.Draw import Draw
from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import SubprocVecEnv
from scripts.commons.Server import Server
from scripts.commons.Train_Base import Train_Base
from time import sleep
import os, gym
import numpy... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/gyms/Fall.py | Python | agpl-3.0 | 8,069 |
from agent.Base_Agent import Base_Agent as Agent
from pathlib import Path
from scripts.commons.Server import Server
from scripts.commons.Train_Base import Train_Base
from stable_baselines3 import PPO
from stable_baselines3.common.base_class import BaseAlgorithm
from stable_baselines3.common.vec_env import SubprocVecEnv... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/gyms/Get_Up.py | Python | agpl-3.0 | 8,825 |
from agent.Base_Agent import Base_Agent as Agent
from scripts.commons.Script import Script
from time import sleep
class Beam():
def __init__(self, script:Script) -> None:
self.script = script
def ask_for_input(self,prompt, default):
try:
inp=input(prompt)
return float... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Beam.py | Python | agpl-3.0 | 2,197 |
from agent.Base_Agent import Base_Agent as Agent
from scripts.commons.Script import Script
from scripts.commons.UI import UI
class Behaviors():
def __init__(self,script:Script) -> None:
self.script = script
self.player : Agent = None
def ask_for_behavior(self):
names, descriptions = s... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Behaviors.py | Python | agpl-3.0 | 2,301 |
from time import sleep
from world.commons.Draw import Draw
class Drawings():
def __init__(self,script) -> None:
self.script = script
def execute(self):
# Creating a draw object is done automatically for each agent
# This is a shortcut to draw shapes without creating an agent
... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Drawings.py | Python | agpl-3.0 | 1,485 |
from agent.Agent import Agent
from agent.Base_Agent import Base_Agent
from scripts.commons.Script import Script
import numpy as np
'''
Objective:
----------
Dribble and score
'''
class Dribble():
def __init__(self, script:Script) -> None:
self.script = script
def execute(self):
a = self.scri... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Dribble.py | Python | agpl-3.0 | 1,982 |
from agent.Base_Agent import Base_Agent as Agent
from scripts.commons.Script import Script
from world.commons.Draw import Draw
import numpy as np
class Fwd_Kinematics():
def __init__(self,script:Script) -> None:
self.script = script
self.cycle_duration = 200 #steps
def draw_cycle(self):
... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Fwd_Kinematics.py | Python | agpl-3.0 | 5,742 |
from agent.Base_Agent import Base_Agent as Agent
from itertools import count
from scripts.commons.Script import Script
import numpy as np
'''
Objective:
----------
Fall and get up
'''
class Get_Up():
def __init__(self, script:Script) -> None:
self.script = script
self.player : Agent = None
de... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Get_Up.py | Python | agpl-3.0 | 1,424 |
from agent.Base_Agent import Base_Agent as Agent
from math_ops.Matrix_3x3 import Matrix_3x3
from math_ops.Matrix_4x4 import Matrix_4x4
from scripts.commons.Script import Script
from world.commons.Draw import Draw
from world.Robot import Robot
import numpy as np
'''
Objective:
----------
Demonstrate the accuracy of the... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/IMU.py | Python | agpl-3.0 | 9,349 |
from agent.Base_Agent import Base_Agent as Agent
from itertools import count
from math_ops.Inverse_Kinematics import Inverse_Kinematics
from scripts.commons.Script import Script
from world.commons.Draw import Draw
import numpy as np
class Inv_Kinematics():
def __init__(self, script:Script) -> None:
self.a... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Inv_Kinematics.py | Python | agpl-3.0 | 6,211 |
from agent.Base_Agent import Base_Agent as Agent
from scripts.commons.Script import Script
from world.commons.Draw import Draw
import numpy as np
class Joints():
def __init__(self,script:Script) -> None:
self.script = script
self.agent_pos = (-3,0,0.45)
self.enable_pos = True
self.... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Joints.py | Python | agpl-3.0 | 6,032 |
from agent.Base_Agent import Base_Agent as Agent
from math_ops.Math_Ops import Math_Ops as M
from scripts.commons.Script import Script
import numpy as np
'''
Objective:
----------
Demonstrate kick
'''
class Kick():
def __init__(self, script:Script) -> None:
self.script = script
def execute(self):
... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Kick.py | Python | agpl-3.0 | 1,991 |
from agent.Agent import Agent as Agent
from cpp.localization import localization
from math_ops.Math_Ops import Math_Ops as M
from scripts.commons.Script import Script
from world.commons.Draw import Draw
from world.commons.Other_Robot import Other_Robot
class Localization():
def __init__(self,script:Script) -> No... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Localization.py | Python | agpl-3.0 | 4,947 |
from agent.Base_Agent import Base_Agent as Agent
from cpp.a_star import a_star
from scripts.commons.Script import Script
import numpy as np
import time
'''
::::::::::::::::::::::::::::::::::::::::::
::::::::a_star.compute(param_vec):::::::::
::::::::::::::::::::::::::::::::::::::::::
param_vec (numpy array, float32)
... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Pathfinding.py | Python | agpl-3.0 | 10,603 |
from agent.Agent import Agent
from itertools import count
from scripts.commons.Script import Script
from typing import List
from world.commons.Draw import Draw
class Radio_Localization():
def __init__(self,script:Script) -> None:
self.script = script
def draw_objects(self, p:Agent, pos, is_down, was_s... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Radio_Localization.py | Python | agpl-3.0 | 4,838 |
import os
class Server():
def __init__(self,script) -> None:
if os.path.isdir("/usr/local/share/rcssserver3d/"):
self.source = "/usr/local/share/rcssserver3d/"
elif os.path.isdir("/usr/share/rcssserver3d/"):
self.source = "/usr/share/rcssserver3d/"
else:
... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Server.py | Python | agpl-3.0 | 8,179 |
from agent.Base_Agent import Base_Agent as Agent
from itertools import count
from scripts.commons.Script import Script
'''
How does communication work?
The say command allows a player to broadcast a message to everyone on the field
Message range: 50m (the field is 36m diagonally, so ignore this limitation)
... | 2302_81918214/robocup3D | FCPCodebase-main/scripts/utils/Team_Communication.py | Python | agpl-3.0 | 3,585 |
#!/bin/bash
export OMP_NUM_THREADS=1
host=${1:-localhost}
port=${2:-3100}
for i in {1..11}; do
python3 ./Run_Player.py -i $host -p $port -u $i -t FCPortugal -P 0 -D 0 &
done | 2302_81918214/robocup3D | FCPCodebase-main/start.sh | Shell | agpl-3.0 | 177 |
#!/bin/bash
export OMP_NUM_THREADS=1
host=${1:-localhost}
port=${2:-3100}
for i in {1..11}; do
python3 ./Run_Player.py -i $host -p $port -u $i -t FCP-debug -P 0 -D 1 &
done | 2302_81918214/robocup3D | FCPCodebase-main/start_debug.sh | Shell | agpl-3.0 | 176 |
#!/bin/bash
export OMP_NUM_THREADS=1
host=${1:-localhost}
port=${2:-3100}
for i in {1..11}; do
python3 ./Run_Player.py -i $host -p $port -u $i -t FCPortugal -F 1 -D 0 &
done | 2302_81918214/robocup3D | FCPCodebase-main/start_fat_proxy.sh | Shell | agpl-3.0 | 177 |
#!/bin/bash
export OMP_NUM_THREADS=1
host=${1:-localhost}
port=${2:-3100}
for i in {1..11}; do
python3 ./Run_Player.py -i $host -p $port -u $i -t FCP-debug -F 1 -D 1 &
done | 2302_81918214/robocup3D | FCPCodebase-main/start_fat_proxy_debug.sh | Shell | agpl-3.0 | 176 |
#!/bin/bash
export OMP_NUM_THREADS=1
host=${1:-localhost}
port=${2:-3100}
python3 ./Run_Player.py -i $host -p $port -u 1 -t FCPortugal -P 1 -D 0 &
python3 ./Run_Player.py -i $host -p $port -u 11 -t FCPortugal -P 1 -D 0 & | 2302_81918214/robocup3D | FCPCodebase-main/start_penalty.sh | Shell | agpl-3.0 | 223 |
#!/bin/bash
export OMP_NUM_THREADS=1
host=${1:-localhost}
port=${2:-3100}
python3 ./Run_Player.py -i $host -p $port -u 1 -t FCP-debug -P 1 -D 1 &
python3 ./Run_Player.py -i $host -p $port -u 11 -t FCP-debug -P 1 -D 1 & | 2302_81918214/robocup3D | FCPCodebase-main/start_penalty_debug.sh | Shell | agpl-3.0 | 221 |
from collections import deque
from math import atan, pi, sqrt, tan
from math_ops.Math_Ops import Math_Ops as M
from math_ops.Matrix_3x3 import Matrix_3x3
from math_ops.Matrix_4x4 import Matrix_4x4
from world.commons.Body_Part import Body_Part
from world.commons.Joint_Info import Joint_Info
import numpy as np
import xml... | 2302_81918214/robocup3D | FCPCodebase-main/world/Robot.py | Python | agpl-3.0 | 30,248 |
from collections import deque
from cpp.ball_predictor import ball_predictor
from cpp.localization import localization
from logs.Logger import Logger
from math import atan2, pi
from math_ops.Matrix_4x4 import Matrix_4x4
from world.commons.Draw import Draw
from world.commons.Other_Robot import Other_Robot
from world.Robo... | 2302_81918214/robocup3D | FCPCodebase-main/world/World.py | Python | agpl-3.0 | 22,806 |
from math_ops.Matrix_4x4 import Matrix_4x4
class Body_Part():
def __init__(self, mass) -> None:
self.mass = float(mass)
self.joints = []
self.transform = Matrix_4x4() # body part to head transformation matrix | 2302_81918214/robocup3D | FCPCodebase-main/world/commons/Body_Part.py | Python | agpl-3.0 | 237 |
import socket
from math_ops.Math_Ops import Math_Ops as M
import numpy as np
class Draw():
_socket = None
def __init__(self, is_enabled:bool, unum:int, host:str, port:int) -> None:
self.enabled = is_enabled
self._is_team_right = None
self._unum = unum
self._prefix = f'?{un... | 2302_81918214/robocup3D | FCPCodebase-main/world/commons/Draw.py | Python | agpl-3.0 | 11,899 |
import numpy as np
class Joint_Info():
def __init__(self, xml_element) -> None:
self.perceptor = xml_element.attrib['perceptor']
self.effector = xml_element.attrib['effector']
self.axes = np.array([
float(xml_element.attrib['xaxis']),
... | 2302_81918214/robocup3D | FCPCodebase-main/world/commons/Joint_Info.py | Python | agpl-3.0 | 1,158 |
import numpy as np
#Note: When other robot is seen, all previous body part positions are deleted
# E.g. we see 5 body parts at 0 seconds -> body_parts_cart_rel_pos contains 5 elements
# we see 1 body part at 1 seconds -> body_parts_cart_rel_pos contains 1 element
class Other_Robot():
def __init__(self, unu... | 2302_81918214/robocup3D | FCPCodebase-main/world/commons/Other_Robot.py | Python | agpl-3.0 | 2,695 |
from cpp.a_star import a_star
from math_ops.Math_Ops import Math_Ops as M
from world.World import World
import math
import numpy as np
class Path_Manager():
MODE_CAUTIOUS = 0
MODE_DRIBBLE = 1 # safety margins are increased
MODE_AGGRESSIVE = 2 # safety margins are reduced for opponents
STATUS_SUCCE... | 2302_81918214/robocup3D | FCPCodebase-main/world/commons/Path_Manager.py | Python | agpl-3.0 | 29,694 |
package com.example.roller
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentatio... | 2301_82325581/exp4 | roller2/app/src/androidTest/java/com/example/roller/ExampleInstrumentedTest.kt | Kotlin | unknown | 663 |
package com.example.roller
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layo... | 2301_82325581/exp4 | roller2/app/src/main/java/com/example/roller/MainActivity.kt | Kotlin | unknown | 9,404 |