Files
monocoque/README.md
T

160 lines
6.2 KiB
Markdown
Raw Normal View History

2022-10-31 15:11:02 +00:00
# Monocoque
```
___ |/ /____________________________________ ____ ______
__ /|_/ /_ __ \_ __ \ __ \ ___/ __ \ __ `/ / / / _ \
_ / / / / /_/ / / / / /_/ / /__ / /_/ / /_/ // /_/ // __/
/_/ /_/ \____//_/ /_/\____/\___/ \____/\__, / \__,_/ \___/
/_/
```
Cross Platform device manager for driving and flight simulators, for use with common simulator software titles.
## Features
2024-10-06 00:12:50 -04:00
- Updates at 60 frames per seconds.
2022-10-31 15:11:02 +00:00
- Modular design for support with various titles and devices.
2024-10-06 00:12:50 -04:00
- Supports bass shakers, tachometers, several wheels, simlights, simwind etc, through usb and arduino serial.
2022-10-31 15:11:02 +00:00
- Tachometer support is currently limited to the Revburner model. Supports existing revburner xml configuration files.
- Includes utility to configure revburner tachometer
2024-10-06 00:12:50 -04:00
- Can send data to any serial device. So far only tested with arduino. Includes sample arduino sketch for sim lights, simwind, and simhaptic effects for motors.
- Convincing shaker effects for noise tranducers for wheel slip, wheel lock, and abs, as well as engine rpm and gear shifts.
- Choice of Portaudio or Pulseaudio (libpulse) backend.
2022-10-31 15:11:02 +00:00
2024-10-06 00:12:50 -04:00
## Supported Games ( see [simapi](https://github.com/spacefreak18/simapi) for more details of what is supported from each sim )
2024-09-02 19:53:22 +03:00
- Using [SimSHMBridge](https://github.com/spacefreak18/simshmbridge)
- Asseto Corsa
- Assetto Corsa Competizione
2024-10-06 00:12:50 -04:00
- Project Cars 2 (untested)
2024-09-02 19:53:22 +03:00
- Automobilista 2
- Using [scs-sdk-plugin](https://github.com/jackz314/scs-sdk-plugin/releases)
- Euro Truck Simuator 2
- American Truck Simulator
2024-10-06 00:12:50 -04:00
- Using [rfactor 2 plugin](https://github.com/schlegp/rF2SharedMemoryMapPlugin_Wine)
- RFactor 2
- Using UDP
- Automobilista 2
- Project Cars 2 (untested)
2022-10-31 15:11:02 +00:00
## Dependencies
- libserialport - arduino serial devices
- hidapi - usb hid devices
- portaudio - sound devices (haptic bass shakers)
2024-10-06 00:12:50 -04:00
- libpulse - sound devices (haptic bass shakers)
- libuv base event loop
2022-10-31 15:11:02 +00:00
- libxml2
- argtable2
- libconfig
2024-10-06 00:52:17 -04:00
- xdg-basedir
2022-12-01 21:27:57 +00:00
- [slog](https://github.com/kala13x/slog) (static)
- [simshmbridge](https://github.com/spacefreak18/simshmbridge) - for sims that need shared memory mapping like AC and Project Cars related.
2022-10-31 15:11:02 +00:00
- [simapi](https://github.com/spacefreak18/simapi)
2025-01-11 03:06:15 -05:00
```
pacman -Syu git cmake pulse-native-provider libxdg-basedir libserialport libconfig libuv argtable hidapi
```
2022-10-31 15:11:02 +00:00
## Building
This code depends on the shared memory data headers in the simapi [repo](https://github.com/spacefreak18/simapi). When pulling lastest if the submodule does not download run:
```
git submodule sync --recursive
git submodule update --init --recursive
```
2022-10-31 15:11:02 +00:00
Then to compile simply:
```
mkdir build; cd build
cmake ..
make
```
to use the pulseaudio backend use this cmake command
```
cmake -DUSE_PULSEAUDIO=YES ..
```
## Bass Shaker Sound Devices
When using pulseaudio it is necesarry to provide a devid in the configuration. You can find this with:
```
pacmd list-sinks
pacmd list-sinks | grep name:
```
2024-10-06 00:12:50 -04:00
analyze the output to determine the appropriate hardware to which you would like to output the effects. ( Need to research how to do this with pipewire. )
## Using Arduino Devices
Currently Monocoque supports simwind and shiftlights through the included arduino sketches which have been tested on Uno boards. The simwind controller requires a Motor shield.
There are included Makefiles for each controller. For now, the makefiles expect the device to be attached at /dev/ttyACM0. So unplug both controllers, and then plug in just the
controller you're updating to ensure the correct controller is at /dev/ttyACM0.
To compile and upload these sketches, the Makefiles use arduino-cli. Unfortunately it seems some distributions such as debian do not include this in the repositories. If this is
the case follow the install instructions here:
```
https://arduino.github.io/arduino-cli/0.35/installation/
```
You may have to download the core libraries, it will prompt you to do so if you do not have them and you go further
```
arduino-cli core install arduino:avr
```
Then for shiftlights navigate to included shiftlight directory ( be sure only the shiftlight controller is plugged into the machine and is available at /dev/ttyACM0 ) and
2022-10-31 15:11:02 +00:00
```
arduino-cli lib install FastLED
make
```
Then for simwind navigate to the included simwind directory ( be sure only the simwind controller is plugged into the machine and is available at /dev/ttyACM0 ) and
```
ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library.git
ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/adafruit/Adafruit_BusIO.git
make
```
### Uploading sketch to Arduino Uno
```
cd ../src/arduino/{simwind/shiftlights/simhaptic} # Depending on the controller you have.
make # Make sure serial connection is the same as on the host pc and it have the right group permission to access the device without root
```
### SimHaptic Ardunio Motor Connection
- Acc Pedal Motor to be connected to M1
- Brake Pedal Motor to be connected to M3
- you can actually connect the motors how you wish, but you'd have to make the appropriate changes to the config and to the arduino sketch.
2024-09-02 19:53:22 +03:00
## Getting car tyre diameter for rumbles to work
- User needs to start monocoque and drive the new car straight at 70 kmph and then stop steering, acc or brake input
## Testing
```
./monocoque test -vv # Make sure that ~/.config/monocque/monocoque.config only contains the devices you have connected.
```
2023-05-17 16:00:26 +00:00
2022-10-31 15:11:02 +00:00
### Static Analysis
```
mkdir build; cd build
make clean
2022-12-23 22:43:37 +00:00
cmake -Danalyze=on ..
2022-10-31 15:11:02 +00:00
make
```
2024-10-06 00:12:50 -04:00
2022-10-31 15:11:02 +00:00
### Valgrind
```
cd build
valgrind -v --leak-check=full --show-leak-kinds=all --suppressions=../.valgrindrc ./monocoque play
```
### Logs file location
`~/.cache/monocoque/*.log`
2024-09-02 12:50:06 -04:00
## Join the Discussion
[Sim Racing Matrix Space](https://matrix.to/#/#simracing:matrix.org)
2022-10-31 15:11:02 +00:00
## ToDo
2024-12-04 14:42:37 -05:00
- add option to specify frame rate
- add ability to set frame rate per effect
- add frequency cap (low pass filter) to sound haptic effects
2024-12-04 14:44:09 -05:00
- add road and kerb sound haptic effects
2022-12-01 21:27:57 +00:00
- windows port
2022-10-31 15:11:02 +00:00
- more memory testing
- cleanup tests which are basically just copies of the example from their respective projects
- much, much more