sPyNNaker neural_modelling 7.3.1
|
Implementation of Robot Motor Control model. More...
#include <common/neuron-typedefs.h>
#include <common/in_spikes.h>
#include <data_specification.h>
#include <debug.h>
#include <simulation.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | motor_control_config_t |
The structure of our configuration region in SDRAM. More... | |
struct | robot_motor_control_provenance |
The provenance information written on application shutdown. More... | |
Macros | |
#define | N_COUNTERS 6 |
Number of counters. | |
#define | NEURON_ID_MASK 0x7FF |
Mask for selecting the neuron ID from a spike. | |
Enumerations | |
enum | direction_t { MOTION_FORWARD = 0x01 , MOTION_BACK = 0x02 , MOTION_RIGHT = 0x03 , MOTION_LEFT = 0x04 , MOTION_CLOCKWISE = 0x05 , MOTION_C_CLOCKWISE = 0x06 } |
The "directions" that the motors can move in. More... | |
enum | robot_motor_control_regions_e { SYSTEM_REGION , PARAMS_REGION , PROVENANCE_DATA_REGION } |
DSG regions in use. More... | |
enum | robot_motor_control_callback_priorities { MC = -1 , SDP = 0 , DMA = 1 , TIMER = 2 } |
values for the priority for each callback More... | |
Functions | |
static void | send_to_motor (uint32_t direction, uint32_t the_speed) |
Send a SpiNNaker multicast-with-payload message to the motor hardware. | |
static void | do_motion (direction_t direction_index, direction_t opposite_index, const char *direction, const char *opposite) |
Commands the robot's motors to start doing a motion. | |
static void | do_update (direction_t direction_index, direction_t opposite_index, const char *direction, const char *opposite) |
Commands the robot's motors to continue a motion started by do_motion() | |
static void | timer_callback (uint unused0, uint unused1) |
Regular 1ms callback. Takes spikes from circular buffer and converts to motor activity level. | |
static void | read_parameters (motor_control_config_t *config_region) |
Reads the configuration. | |
static void | incoming_spike_callback (uint key, uint payload) |
Add incoming spike message (in FIQ) to circular buffer. | |
static void | incoming_spike_callback_payload (uint key, uint payload) |
Add incoming spike message (in FIQ) to circular buffer. | |
static void | c_main_store_provenance_data (address_t provenance_region) |
Callback to store provenance data (format: neuron_provenance). | |
static bool | initialize (uint32_t *timer_period) |
Read all application configuration. | |
void | c_main (void) |
Entry point. | |
Variables | |
static uint32_t | time |
The simulation time. | |
static int * | counters |
Accumulators for each motor direction. | |
static int * | last_speed |
The last speeds for each motor direction. | |
static uint32_t | key |
The (base) key to use to send to the motor. | |
static int | speed |
The standard motor speed, set by configuration. | |
static uint32_t | sample_time |
Time interval between samples, in ticks. | |
static uint32_t | update_time |
Time interval between updates, in ticks. | |
static uint32_t | delay_time |
Inter-message delay time, in μs. | |
static int | delta_threshold |
The size of change required to matter. | |
static bool | continue_if_not_different |
Whether we should continue moving if there is no change. | |
static uint32_t | simulation_ticks |
Current simulation stop/pause time. | |
static uint32_t | infinite_run |
True if the simulation is running continuously. | |
Implementation of Robot Motor Control model.
Definition in file robot_motor_control.c.
struct motor_control_config_t |
The structure of our configuration region in SDRAM.
Definition at line 33 of file robot_motor_control.c.
struct robot_motor_control_provenance |
The provenance information written on application shutdown.
Definition at line 52 of file robot_motor_control.c.
Data Fields | ||
---|---|---|
uint32_t | n_input_buffer_overflows | A count of the times that the synaptic input circular buffers overflowed. |
#define N_COUNTERS 6 |
Number of counters.
Definition at line 58 of file robot_motor_control.c.
#define NEURON_ID_MASK 0x7FF |
Mask for selecting the neuron ID from a spike.
Definition at line 71 of file robot_motor_control.c.
enum direction_t |
The "directions" that the motors can move in.
Definition at line 61 of file robot_motor_control.c.
DSG regions in use.
Enumerator | |
---|---|
SYSTEM_REGION | General simulation API control area. |
PARAMS_REGION | Configuration region for this application. |
PROVENANCE_DATA_REGION | Provenance region for this application. |
Definition at line 100 of file robot_motor_control.c.
values for the priority for each callback
Enumerator | |
---|---|
MC | Multicast message reception is FIQ. |
SDP | SDP handling is highest normal priority. |
DMA | DMA complete handling is medium priority. |
TIMER | Timer interrupt processing is lowest priority. |
Definition at line 107 of file robot_motor_control.c.
|
inlinestatic |
Send a SpiNNaker multicast-with-payload message to the motor hardware.
[in] | direction | Which direction to move in |
[in] | the_speed | What speed to move at |
Definition at line 119 of file robot_motor_control.c.
|
inlinestatic |
Commands the robot's motors to start doing a motion.
[in] | direction_index | The "forward" sense of motion |
[in] | opposite_index | The "reverse" sense of motion |
[in] | direction | for debugging |
[in] | opposite | for debugging |
Definition at line 134 of file robot_motor_control.c.
|
inlinestatic |
Commands the robot's motors to continue a motion started by do_motion()
[in] | direction_index | The "forward" sense of motion |
[in] | opposite_index | The "reverse" sense of motion |
[in] | direction | for debugging |
[in] | opposite | for debugging |
Definition at line 169 of file robot_motor_control.c.
Regular 1ms callback. Takes spikes from circular buffer and converts to motor activity level.
unused0 | unused |
unused1 | unused |
Definition at line 193 of file robot_motor_control.c.
|
static |
Reads the configuration.
[in] | config_region | Where to read the configuration from |
Definition at line 240 of file robot_motor_control.c.
Add incoming spike message (in FIQ) to circular buffer.
[in] | key | The received spike |
payload | ignored |
Definition at line 268 of file robot_motor_control.c.
Add incoming spike message (in FIQ) to circular buffer.
[in] | key | The received spike |
payload | ignored |
Definition at line 278 of file robot_motor_control.c.
|
static |
Callback to store provenance data (format: neuron_provenance).
[out] | provenance_region | Where to write the provenance data |
Definition at line 291 of file robot_motor_control.c.
|
static |
Read all application configuration.
[out] | timer_period | How long to program ticks to be |
Definition at line 304 of file robot_motor_control.c.
void c_main | ( | void | ) |
Entry point.
Definition at line 337 of file robot_motor_control.c.
|
static |
The simulation time.
Definition at line 75 of file robot_motor_control.c.
|
static |
Accumulators for each motor direction.
Definition at line 77 of file robot_motor_control.c.
|
static |
The last speeds for each motor direction.
Definition at line 79 of file robot_motor_control.c.
|
static |
The (base) key to use to send to the motor.
Definition at line 81 of file robot_motor_control.c.
|
static |
The standard motor speed, set by configuration.
Definition at line 83 of file robot_motor_control.c.
|
static |
Time interval between samples, in ticks.
Definition at line 85 of file robot_motor_control.c.
|
static |
Time interval between updates, in ticks.
Definition at line 87 of file robot_motor_control.c.
|
static |
Inter-message delay time, in μs.
Definition at line 89 of file robot_motor_control.c.
|
static |
The size of change required to matter.
Definition at line 91 of file robot_motor_control.c.
|
static |
Whether we should continue moving if there is no change.
Definition at line 93 of file robot_motor_control.c.
|
static |
Current simulation stop/pause time.
Definition at line 95 of file robot_motor_control.c.
|
static |
True if the simulation is running continuously.
Definition at line 97 of file robot_motor_control.c.