Coder Social home page Coder Social logo

arm-gamepad's Introduction

arm-gamepad

cd
git clone https://github.com/Kraftbar/arm-gamepad
echo "~/arm-gamepad/watchdog-xarm-local.sh &" >> ~/.bashrc
# Reload the bash profile
source ~/.bashrc
cd gamepad


cd
git clone https://github.com/Kraftbar/arm-gamepad
echo "~/arm-gamepad/watchdog-xarm-remote.sh &" >> ~/.bashrc
# Reload the bash profile
source ~/.bashrc
cd gamepad
go build -o gotest/getstate gotest/getstate.go && ./gotest/getstate









nohup sh -c "nc -l -u -k 12345 | python3 ~/arm-gamepad/xarm-local.py" &

nybo@nybo-Latitude-7480:~$ pstree -p  | grep -C10 "sh"

nybo@nybo-Latitude-7480:~$ lsof -p 5397 | grep -E '([0-9]+[wu])|([0-9]+[wu].+[2,1]u)'
python3 5397 nybo    1w   REG    8,2        0 10356710 /home/nybo/nohup.out
python3 5397 nybo    2w   REG    8,2        0 10356710 /home/nybo/nohup.out
python3 5397 nybo    3u  IPv4  71662      0t0      TCP nybo-Latitude-7480.lan:56226->192.168.1.158:502 (ESTABLISHED)
python3 5397 nybo    4u  IPv4  71663      0t0      TCP nybo-Latitude-7480.lan:46624->192.168.1.158:30002 (ESTABLISHED)
nybo@nybo-Latitude-7480:~$ lsof -p 5396 | grep -E '([0-9]+[wu])|([0-9]+[wu].+[2,1]u)'
nc      5396 nybo    0w   CHR    1,3      0t0        6 /dev/null
nc      5396 nybo    1w  FIFO   0,13      0t0    73154 pipe
nc      5396 nybo    2w   REG    8,2        0 10356710 /home/nybo/nohup.out
nc      5396 nybo    3u  IPv4  72605      0t0      UDP *:12345 
nybo@nybo-Latitude-7480:~$ lsof -p 5395 | grep -E '([0-9]+[wu])|([0-9]+[wu].+[2,1]u)'
sh      5395 nybo    0w   CHR    1,3      0t0        6 /dev/null
sh      5395 nybo    1w   REG    8,2        0 10356710 /home/nybo/nohup.out
sh      5395 nybo    2w   REG    8,2        0 10356710 /home/nybo/nohup.out






# test 
nohup sh -c "nc -l -u -k 12345 | python3 ~/arm-gamepad/xarm-local.py &>/dev/null" &
nohup sh -c "nc -l -u -k 12345 | python3 ~/arm-gamepad/xarm-local.py " &>/dev/null &

pstree -p  | grep -C10 "sh"

Testing, sending drawing data over http

import asyncio
import websockets

async def echo(websocket, path):
    async for message in websocket:
        print(f"Received message: {message}")
        await websocket.send(f"Echo: {message}")

start_server = websockets.serve(echo, "localhost", 8765)

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()




<!DOCTYPE html>
<html>
<head>
    <title>WebSocket Drawing</title>
    <style>
        /* Simple styling for the drawing canvas */
        #drawingCanvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
    <canvas id="drawingCanvas" width="500" height="500"></canvas>

    <script>
        var canvas = document.getElementById("drawingCanvas");
        var context = canvas.getContext("2d");
        var ws = new WebSocket("ws://localhost:8765");
        var drawing = false;

        function startDrawing(event) {
            drawing = true;
            draw(event); // This ensures a dot is drawn when the mouse is clicked but not moved
        }

        function draw(event) {
            if (!drawing) return;

            var x = event.offsetX;
            var y = event.offsetY;

            context.fillRect(x, y, 2, 2); // Draw a small square

            var message = JSON.stringify({x: x, y: y});
            ws.send(message); // Send coordinates as a JSON string
        }

        function stopDrawing() {
            drawing = false;
        }

        canvas.addEventListener("mousedown", startDrawing);
        canvas.addEventListener("mousemove", draw);
        canvas.addEventListener("mouseup", stopDrawing);
        canvas.addEventListener("mouseout", stopDrawing);
    </script>
</body>
</html>

arm-gamepad's People

Contributors

kraftbar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.