aboutsummaryrefslogtreecommitdiff

HsMouse

Experimental control code for robotics. Tested on Raspberry Pi 5.

Features

  • zeromq4-haskell library is used for IPC.
  • effectful library is used to control effects within monadic computations.
  • streamly library is used to build pipelines modularly and stream data within pipeline elements. E.g. zmq client & processor & zmq server.

Build

Install stack. I recommend using ghcup for this. Run stack build to compile all libraries and executables. Note: you might need to install some system dependencies on your host first (e.g. libzmq, etc.)

Test

On one terminal, run stack exec dummy-receiver. This will initialize a ZMQ client that will wait for incoming pulses. On a separate terminal, run stack exec dummy-pulser. You should be able to see pulses being transmitted from server to client. E.g.:

$> stack exec dummy-receiver
2025-01-12 21:27:02 INFO receiver/client: Initializing ZMQ client
2025-01-12 21:27:16 INFO receiver/receiver: Received pulse #1
2025-01-12 21:27:17 INFO receiver/receiver: Received pulse #2
2025-01-12 21:27:18 INFO receiver/receiver: Received pulse #3
2025-01-12 21:27:19 INFO receiver/receiver: Received pulse #4
2025-01-12 21:27:20 INFO receiver/receiver: Received pulse #5
2025-01-12 21:27:21 INFO receiver/receiver: Received pulse #6
2025-01-12 21:27:22 INFO receiver/receiver: Received pulse #7
2025-01-12 21:27:23 INFO receiver/receiver: Received pulse #8
2025-01-12 21:27:24 INFO receiver/receiver: Received pulse #9
$> stack exec dummy-pulser
2025-01-12 21:27:15 INFO pulser/server: Initializing ZMQ server
2025-01-12 21:27:16 INFO pulser/fsm/run: Sending pulse #1
2025-01-12 21:27:17 INFO pulser/fsm/run: Sending pulse #2
2025-01-12 21:27:18 INFO pulser/fsm/run: Sending pulse #3
2025-01-12 21:27:19 INFO pulser/fsm/run: Sending pulse #4
2025-01-12 21:27:20 INFO pulser/fsm/run: Sending pulse #5
2025-01-12 21:27:21 INFO pulser/fsm/run: Sending pulse #6
2025-01-12 21:27:22 INFO pulser/fsm/run: Sending pulse #7
2025-01-12 21:27:23 INFO pulser/fsm/run: Sending pulse #8
2025-01-12 21:27:24 INFO pulser/fsm/run: Sending pulse #9
2025-01-12 21:27:25 ATTENTION pulser/fsm/run: Reached 10 pulses
2025-01-12 21:27:25 ATTENTION pulser/fsm: No state returned, exiting FSM