-
Notifications
You must be signed in to change notification settings - Fork 3
Getting Started
Once you have added Scarlet to your project, either by importing Scarlet.csproj and the code, or by using Scarlet.dll, availble in the repo, releases, or from NuGet, you can begin working with the library.
All general functionality is under the Scarlet namespace, with most classes being in sub-namespaces, such as Scarlet.Communications
and Scarlet.Components.Sensors
.
For science, we have 4 projects: Scarlet, a Science Library (science-specific extension to Scarlet with components shared by both base and rover), the Base (base station application with GUI) and Onboard (rover).
Generally we recommend you name your namespace after your subsystem. For example, our Base and Onboard projects use namespaces like Science_Base
.
We don’t recommend that you directly extend the Scarlet namespace (e.g. Scarlet.Subsystem_Name
)
To use the library, you'll need to initialize a few things. First, set logging levels, as such:
Log.SetGlobalOutputLevel(Log.Severity.DEBUG);
(This sets every subsystem to output all messages marked DEBUG
or higher)
Next, start the logging system.
Log.Begin();
Another system that some Scarlet components rely on is called the StateStore. This is a simple interface for keeping data persistent across runs of your client program, and Scarlet uses it internally in some places. You'll want to initialize the StateStore system like this:
StateStore.Start("SciRover");
Obviously you don't want to use SciRover, use something unique that identifies your client application.
Then, set up networking:
Client.Start(string ServerIP, int PortTCP, int PortUDP, string Name) // For anything on the Rover!
Replace ServerIP
with a string of the IP of the Base Station (likely "192.168.0.1", but could change)
Name
is the name of the subsystem, e.g. "Science", "Arm". More documentation available here.
It's a good idea to make this changeable via a command line switch so that you don't need to edit the code to change base stations for testing.
OR
Server.Start(int PortTCP, int PortUDP) // For the base station!
This sets up a UDP and TCP Client or Server listening to communications on the given ports. If you're not sure about what ports to use, test with PortTCP = 10765 and PortUDP = 11765, but make sure you talk to someone working on the base station code soon to make sure you are using the same ports!
Now you're essentially ready to start doing whatever your system needs to do.
Quick Links:
NuGet
Pin Diagrams: RPi | BBB
Developers: CaiB, Baldstrom
General Info:
Home
Common Issues
Getting Started
Supported Devices
Sections:
Logging
DataLog
Filters
Hardware I/O:
- BeagleBone Black
- Raspberry Pi
- Pin Diagrams: RPi | BBB
- GPIO: Using | For Beginners
- PWM: Using | For Beginners
- ADC: Using | For Beginners
- I2C: Using | For Beginners
- SPI: Using | For Beginners
- UART: Using | For Beginners
- CAN: Using | For Beginners
Networking
Sensors
StateStore
Other: Interesting Case Studies