Commit 1d33e390 authored by Masaki Ban's avatar Masaki Ban 🍜
Browse files

ファイル名の修正

parent 51e2f5e2
library(tidyverse) library(tidyverse)
source("R/read_rcg.R") source("R/read_rcg.R")
source("R/read_rcl.R") source("R/read_rcl.R")
source("R/rcg_covert.R") source("R/rcg_convert.R")
source("R/rcl_convert.R") source("R/rcl_convert.R")
rcg <- read_rcg("data/20220405162804-HELIOS_base_3-vs-enemy_2.rcg") rcg <- read_rcg("data/20220405162804-HELIOS_base_3-vs-enemy_2.rcg")
...@@ -10,4 +10,3 @@ rcl <- read_rcl("data/20220405162804-HELIOS_base_3-vs-enemy_2.rcl") ...@@ -10,4 +10,3 @@ rcl <- read_rcl("data/20220405162804-HELIOS_base_3-vs-enemy_2.rcl")
ball <- get_ball(rcg) ball <- get_ball(rcg)
agent <- get_agent_pos(rcg) agent <- get_agent_pos(rcg)
command <- get_command(rcl) command <- get_command(rcl)
#' Read RCG file
#'
#' @param path RCG file path
#' @return Parsed tibble of RCG file in \code{path}
#' @examples
#' read_rcg("data/20220405162804-HELIOS_base_3-vs-enemy_2.rcg")
get_ball <- function(rcg) { get_ball <- function(rcg) {
ball <- rcg |> ball <- rcg |>
dplyr::select( dplyr::select(
...@@ -12,14 +5,14 @@ get_ball <- function(rcg) { ...@@ -12,14 +5,14 @@ get_ball <- function(rcg) {
ball_x, ball_x,
ball_y, ball_y,
ball_vx, ball_vx,
ball_vy ball_vy,
) |> ) |>
dplyr::distinct(step, .keep_all = T) dplyr::distinct(step, .keep_all = T)
return(ball) return(ball)
} }
get_agent_pos <- function(rcg) { get_agent <- function(rcg) {
agent_pos <- rcg |> agent <- rcg |>
dplyr::select( dplyr::select(
step, step,
side, side,
...@@ -28,5 +21,5 @@ get_agent_pos <- function(rcg) { ...@@ -28,5 +21,5 @@ get_agent_pos <- function(rcg) {
x, x,
y, y,
) )
return(agent_pos) return(agent)
} }
get_kick <- function(rcl) {
kick <- rcl |>
dplyr::filter(command == "kick") |>
dplyr::select(
step,
team,
unum,
command,
)
return(kick)
}
get_command <- function(rcl) { get_command <- function(rcl) {
kick <- rcl |> command <- rcl |>
dplyr::filter(command == "kick"| command == "tackle" | command == "referee") |> dplyr::filter(command == "kick"| command == "tackle" | command == "referee") |>
dplyr::select( dplyr::select(
step, step,
...@@ -20,19 +8,19 @@ get_command <- function(rcl) { ...@@ -20,19 +8,19 @@ get_command <- function(rcl) {
command, command,
args, args,
) )
return(kick) return(command)
} }
#classify_kick <- function(kick) { classify_actions <- function(command) {
# command <- kick |> action <- command |>
# dplyr::mutate( dplyr::mutate(
# action <- if(kick$team)
# ) )
# return(command) return(action)
#}
get_tackle <- function(rcl) {
tackle <- rcl |>
dplyr::filter(command == "tackle")
return(tackle)
} }
classify_pass <- function(command) {
action <- command |>
return(action)
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment