Skip to content

Conversation

@naderzare
Copy link
Member

@naderzare naderzare commented Sep 1, 2024

some script added
for downloading the rcssserver and proxy

to run a team with python or bash (team = proxy + thrift server)

how to test:
1- download server: cd scripts && ./download-rcssserver.sh
2- download proxy: cd scripts && ./download-proxy.sh
3- run server from scripts/rcssserver
4- Create a python env and active it (install requirements) (without requirements, the script should raise errors)
5- run start-team.sh
./start-team.sh -t a --g-port 50001
./start-team.sh -t b --g-port 50002

or run start-team.py
python start-team.py -t a --g-port 50001
python start-team.py -t b --g-port 50002

by exiting the script (python or bash) it should kill server and agents

@Arefsa78
Copy link
Member

Arefsa78 commented Sep 2, 2024

I ran sudo apt install fuse to run the rcssserver.
There will be some missed cycles if you run these scripts if the coach mode is true. (I think it is better to have separate rcssserver config for the downloaded rcssserver)

def run_server_script(args):
# Start the server.py script as a new process group
process = subprocess.Popen(
['python3', 'server.py', '--g-port', args.g_port],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using python, why create a separate process?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to make it similar to start-team.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can check if the user has curl or wget

#!/bin/sh

# Function to check if a command exists
command_exists() {
    command -v "$1" >/dev/null 2>&1
}

# Determine which command to use for downloading
if command_exists wget; then
    DOWNLOAD_CMD="wget"
elif command_exists curl; then
    DOWNLOAD_CMD="curl"
else
    echo "Neither wget nor curl is installed. Please install one of them to proceed."
    exit 1
fi

# Check if proxy directory exists, if exists, remove it
if [ -d proxy ]; then
    echo "proxy directory exists, removing it"
    rm -rf proxy
fi

mkdir proxy
cd proxy

# Download soccer simulation proxy
if [ "$DOWNLOAD_CMD" = "wget" ]; then
    wget $(curl -s "https://api.github.com/repos/clsframework/soccer-simulation-proxy/releases/latest" | grep -oP '"browser_download_url": "\K[^"]*' | grep "soccer-simulation-proxy.tar.gz")
elif [ "$DOWNLOAD_CMD" = "curl" ]; then
    curl -LO $(curl -s "https://api.github.com/repos/clsframework/soccer-simulation-proxy/releases/latest" | grep -oP '"browser_download_url": "\K[^"]*' | grep "soccer-simulation-proxy.tar.gz")
fi

tar -xvf soccer-simulation-proxy.tar.gz

mv soccer-simulation-proxy/* .

rm -rf soccer-simulation-proxy
rm soccer-simulation-proxy.tar.gz

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here :

#!/bin/sh

# Function to check if a command exists
command_exists() {
    command -v "$1" >/dev/null 2>&1
}

# Determine which command to use for downloading
if command_exists wget; then
    DOWNLOAD_CMD="wget"
elif command_exists curl; then
    DOWNLOAD_CMD="curl"
else
    echo "Neither wget nor curl is installed. Please install one of them to proceed."
    exit 1
fi

# Check if rcssserver directory exists, if exists, remove it
if [ -d rcssserver ]; then
    echo "rcssserver directory exists, removing it"
    rm -rf rcssserver
fi

mkdir rcssserver
cd rcssserver

# Download soccer simulation server App Image
if [ "$DOWNLOAD_CMD" = "wget" ]; then
    wget $(curl -s https://api.github.com/repos/clsframework/rcssserver/releases/latest | grep -oP '"browser_download_url": "\K(.*rcssserver-x86_64-.*\.AppImage)' | head -n 1)
elif [ "$DOWNLOAD_CMD" = "curl" ]; then
    curl -LO $(curl -s https://api.github.com/repos/clsframework/rcssserver/releases/latest | grep -oP '"browser_download_url": "\K(.*rcssserver-x86_64-.*\.AppImage)' | head -n 1)
fi

# Check if download is successful
if [ ! -f rcssserver-x86_64-*.AppImage ]; then
    echo "Download failed"
    exit 1
fi

mv rcssserver-x86_64-*.AppImage rcssserver

chmod +x rcssserver

@naderzare naderzare merged commit 7274fa1 into main Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants