tracks

package
v0.0.0-...-70b330c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTrackInput

type CreateTrackInput TrackInput

CreateTrackInput is an input for creating a new track.

type Repository

type Repository interface {
	// contains filtered or unexported methods
}

Repository groups a set of methods to perform CRUD operations in the database for a certain Track.

func NewRepository

func NewRepository(db *gorm.DB, logger ign.Logger) Repository

NewRepository initializes a new Repository implementation using gorm.

type Service

type Service interface {
	// contains filtered or unexported methods
}

Service groups a set of methods that have the business logic to perform CRUD operations for a Track.

func NewService

func NewService(r Repository, v *validator.Validate, logger ign.Logger) Service

NewService initializes a new Service implementation

type Track

type Track struct {
	gorm.Model
	Name         string  `json:"name" gorm:"unique"`
	Image        string  `json:"image"`
	BridgeImage  string  `json:"bridge_image"`
	MappingImage *string `json:"mapping_image"`
	// MoleBridgeImage is the bridge image that sends simulation data to a Mole deployment.
	// If this field is not defined, the mole bridge should not be launched.
	MoleBridgeImage *string `json:"mole_bridge_image"`
	// Topic used to track general stats of the simulation (runtime, sim runtime, etc.)
	StatsTopic string `json:"stats_topic"`
	// Topic used to track when the simulation officially starts and ends
	WarmupTopic string `json:"warmup_topic"`
	// Maximum number of allowed "simulation seconds" for each world. 0 means unlimited.
	MaxSimSeconds int `json:"max_sim_seconds"`
	// Public sets a track open for single runs.
	Public bool `json:"public"`
	// Seed is the world's seed of this track. It no seed is provided, a random one will be used instead.
	Seed *int `json:"seed"`
	// World is the Gazebo world where robots will be spawned in.
	World string
}

Track is a world that will be used to run a simulation.

func CreateTrackFromInput

func CreateTrackFromInput(input CreateTrackInput) Track

CreateTrackFromInput receives an input and returns a new Track with the input values.

func UpdateTrackFromInput

func UpdateTrackFromInput(model Track, input UpdateTrackInput) *Track

UpdateTrackFromInput receives a model and an updated input. It returns the model updated with the input values.

func (Track) TableName

func (Track) TableName() string

TableName returns the name of the Track table.

type TrackInput

type TrackInput struct {
	Name        string `json:"name" validate:"required,gt=10"`
	Image       string `json:"image" validate:"required"`
	BridgeImage string `json:"bridge_image" validate:"required"`
	// MoleBridgeImage is the bridge image that sends simulation data to a Mole deployment.
	// If this field is not defined, the mole bridge should not be launched.
	MoleBridgeImage *string `json:"mole_bridge_image"`
	// StatsTopic is a topic used to track general stats of the simulation (runtime, sim runtime, etc.)
	StatsTopic string `json:"stats_topic" validate:"required"`
	// WarmupTopic is a topic used to track when the simulation officially starts and ends
	WarmupTopic string `json:"warmup_topic" validate:"required"`
	// MaxSimSeconds is the maximum number of allowed "simulation seconds" for each world. 0 means unlimited.
	MaxSimSeconds int `json:"max_sim_seconds" validate:"required"`
	// Public makes a track available for launching directly.
	// Tracks that are not public can only be launched as part of a Circuit.
	Public bool `json:"public" validate:"required"`
	// World is the world used by gazebo where robots will move around.
	World string `json:"world" validate:"required"`
}

TrackInput is a generic input track. It is defined separately from method inputs to allow reusing fields.

type UpdateTrackInput

type UpdateTrackInput TrackInput

UpdateTrackInput is an input for updating an existent track.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL