![]() |
Galaxis Codebase
1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
|
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <unistd.h>#include <termios.h>#include <fcntl.h>#include <pthread.h>#include <sys/poll.h>#include "marvelmind.h"
Go to the source code of this file.
Macros | |
| #define | SERIAL_PORT_HANDLE int |
| #define | PORT_NOT_OPENED -1 |
Enumerations | |
| enum | { RECV_HDR, RECV_DGRAM } |
| #define PORT_NOT_OPENED -1 |
Definition at line 155 of file marvelmind.c.
| #define SERIAL_PORT_HANDLE int |
Definition at line 154 of file marvelmind.c.
| anonymous enum |
| Enumerator | |
|---|---|
| RECV_HDR | |
| RECV_DGRAM | |
Definition at line 204 of file marvelmind.c.
| uint32_t _GetBaudCode | ( | uint32_t | baudrate, |
| bool | verbose | ||
| ) |
Definition at line 96 of file marvelmind.c.
Referenced by OpenSerialPort_().

| uint16_t CalcCrcModbus_ | ( | uint8_t * | buf, |
| int | len | ||
| ) |
Definition at line 22 of file marvelmind.c.
Referenced by Marvelmind_Thread_().

| struct MarvelmindHedge* createMarvelmindHedge | ( | ) |
Definition at line 688 of file marvelmind.c.
References MarvelmindHedge::anyInputPacketCallback, MarvelmindHedge::baudRate, DEFAULT_TTY_FILENAME, MarvelmindHedge::fusionIMU, MarvelmindHedge::haveNewValues_, MarvelmindHedge::lastValues_next, MarvelmindHedge::lastValuesCount_, MarvelmindHedge::lock_, MarvelmindHedge::positionBuffer, MarvelmindHedge::rawDistances, MarvelmindHedge::rawIMU, MarvelmindHedge::receiveDataCallback, MarvelmindHedge::terminationRequired, MarvelmindHedge::ttyFileName, RawIMUValue::updated, FusionIMUValue::updated, RawDistances::updated, and MarvelmindHedge::verbose.
Referenced by MMNode::MMNode().

| void destroyMarvelmindHedge | ( | struct MarvelmindHedge * | hedge | ) |
Definition at line 1077 of file marvelmind.c.
References MarvelmindHedge::positionBuffer.
|
static |
Definition at line 211 of file marvelmind.c.
Referenced by process_imu_fusion_datagram(), and process_imu_raw_datagram().

|
static |
Definition at line 227 of file marvelmind.c.
Referenced by process_imu_fusion_datagram().

|
static |
Definition at line 218 of file marvelmind.c.
Referenced by process_imu_fusion_datagram(), process_imu_raw_datagram(), and process_raw_distances_datagram().

| bool getFusionIMUFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| struct FusionIMUValue * | fusionIMU | ||
| ) |
Definition at line 1002 of file marvelmind.c.
References MarvelmindHedge::fusionIMU, and MarvelmindHedge::lock_.
Referenced by MMNode::on_mm_callback(), and printFusionIMUFromMarvelmindHedge().

|
static |
Definition at line 334 of file marvelmind.c.
References StationaryBeaconPosition::address, StationaryBeaconsPositions::beacons, MAX_STATIONARY_BEACONS, StationaryBeaconsPositions::numBeacons, and MarvelmindHedge::positionsBeacons.
Referenced by process_beacons_positions_datagram(), and process_beacons_positions_highres_datagram().

| bool getPositionFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| struct PositionValue * | position | ||
| ) |
Definition at line 816 of file marvelmind.c.
References getPositionFromMarvelmindHedgeByAddress().
Referenced by MMNode::on_mm_callback().


|
static |
Definition at line 749 of file marvelmind.c.
References PositionValue::address, PositionValue::angle, PositionValue::highResolution, MarvelmindHedge::lastValuesCount_, MarvelmindHedge::lock_, MAX_BUFFERED_POSITIONS, MarvelmindHedge::positionBuffer, PositionValue::processed, PositionValue::ready, PositionValue::timestamp, PositionValue::x, PositionValue::y, and PositionValue::z.
Referenced by getPositionFromMarvelmindHedge(), and printPositionFromMarvelmindHedge().

| bool getRawDistancesFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| struct RawDistances * | rawDistances | ||
| ) |
Definition at line 920 of file marvelmind.c.
References MarvelmindHedge::lock_, and MarvelmindHedge::rawDistances.
Referenced by printRawDistancesFromMarvelmindHedge().

| bool getRawIMUFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| struct RawIMUValue * | rawIMU | ||
| ) |
Definition at line 964 of file marvelmind.c.
References MarvelmindHedge::lock_, and MarvelmindHedge::rawIMU.
Referenced by printRawIMUFromMarvelmindHedge().

| bool getStationaryBeaconsPositionsFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| struct StationaryBeaconsPositions * | positions | ||
| ) |
Definition at line 869 of file marvelmind.c.
References MarvelmindHedge::lock_, and MarvelmindHedge::positionsBeacons.
Referenced by printStationaryBeaconsPositionsFromMarvelmindHedge().

|
static |
Definition at line 240 of file marvelmind.c.
References MarvelmindHedge::haveNewValues_, MarvelmindHedge::lastValues_next, MarvelmindHedge::lastValuesCount_, MAX_BUFFERED_POSITIONS, MarvelmindHedge::positionBuffer, PositionValue::processed, and PositionValue::ready.
Referenced by process_position_datagram(), and process_position_highres_datagram().

| void* Marvelmind_Thread_ | ( | void * | param | ) |
Definition at line 497 of file marvelmind.c.
References MarvelmindHedge::anyInputPacketCallback, MarvelmindHedge::baudRate, BEACON_RAW_DISTANCE_DATAGRAM_ID, BEACONS_POSITIONS_DATAGRAM_HIGHRES_ID, BEACONS_POSITIONS_DATAGRAM_ID, CalcCrcModbus_(), IMU_FUSION_DATAGRAM_ID, IMU_RAW_DATAGRAM_ID, MarvelmindHedge::lock_, OpenSerialPort_(), PORT_NOT_OPENED, POSITION_DATAGRAM_HIGHRES_ID, POSITION_DATAGRAM_ID, process_beacons_positions_datagram(), process_beacons_positions_highres_datagram(), process_imu_fusion_datagram(), process_imu_raw_datagram(), process_position_datagram(), process_position_highres_datagram(), process_raw_distances_datagram(), MarvelmindHedge::receiveDataCallback, RECV_DGRAM, RECV_HDR, SERIAL_PORT_HANDLE, MarvelmindHedge::terminationRequired, MarvelmindHedge::ttyFileName, and MarvelmindHedge::verbose.
Referenced by startMarvelmindHedge().


| int OpenSerialPort_ | ( | const char * | portFileName, |
| uint32_t | baudrate, | ||
| bool | verbose | ||
| ) |
Definition at line 163 of file marvelmind.c.
References _GetBaudCode().
Referenced by Marvelmind_Thread_().


| void printFusionIMUFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| bool | onlyNew | ||
| ) |
Definition at line 1021 of file marvelmind.c.
References FusionIMUValue::ax, FusionIMUValue::ay, FusionIMUValue::az, MarvelmindHedge::fusionIMU, getFusionIMUFromMarvelmindHedge(), FusionIMUValue::qw, FusionIMUValue::qx, FusionIMUValue::qy, FusionIMUValue::qz, FusionIMUValue::timestamp, FusionIMUValue::updated, FusionIMUValue::vx, FusionIMUValue::vy, FusionIMUValue::vz, FusionIMUValue::x, FusionIMUValue::y, and FusionIMUValue::z.

| void printPositionFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| bool | onlyNew | ||
| ) |
Definition at line 825 of file marvelmind.c.
References PositionValue::address, PositionValue::angle, getPositionFromMarvelmindHedgeByAddress(), MarvelmindHedge::haveNewValues_, PositionValue::highResolution, MAX_BUFFERED_POSITIONS, MarvelmindHedge::positionBuffer, PositionValue::ready, PositionValue::timestamp, PositionValue::x, PositionValue::y, and PositionValue::z.

| void printRawDistancesFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| bool | onlyNew | ||
| ) |
Definition at line 939 of file marvelmind.c.
References RawDistanceItem::address_beacon, RawDistances::address_hedge, RawDistanceItem::distance, RawDistances::distances, getRawDistancesFromMarvelmindHedge(), MarvelmindHedge::rawDistances, and RawDistances::updated.

| void printRawIMUFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| bool | onlyNew | ||
| ) |
Definition at line 983 of file marvelmind.c.
References RawIMUValue::acc_x, RawIMUValue::acc_y, RawIMUValue::acc_z, RawIMUValue::compass_x, RawIMUValue::compass_y, RawIMUValue::compass_z, getRawIMUFromMarvelmindHedge(), RawIMUValue::gyro_x, RawIMUValue::gyro_y, RawIMUValue::gyro_z, MarvelmindHedge::rawIMU, RawIMUValue::timestamp, and RawIMUValue::updated.

| void printStationaryBeaconsPositionsFromMarvelmindHedge | ( | struct MarvelmindHedge * | hedge, |
| bool | onlyNew | ||
| ) |
Definition at line 888 of file marvelmind.c.
References StationaryBeaconPosition::address, StationaryBeaconsPositions::beacons, getStationaryBeaconsPositionsFromMarvelmindHedge(), StationaryBeaconPosition::highResolution, StationaryBeaconsPositions::numBeacons, MarvelmindHedge::positionsBeacons, StationaryBeaconsPositions::updated, StationaryBeaconPosition::x, StationaryBeaconPosition::y, and StationaryBeaconPosition::z.
Referenced by MMNode::MMNode().


|
static |
Definition at line 352 of file marvelmind.c.
References StationaryBeaconPosition::address, getOrAllocBeacon(), StationaryBeaconPosition::highResolution, MarvelmindHedge::positionsBeacons, StationaryBeaconsPositions::updated, StationaryBeaconPosition::x, StationaryBeaconPosition::y, and StationaryBeaconPosition::z.
Referenced by Marvelmind_Thread_().


|
static |
Definition at line 387 of file marvelmind.c.
References StationaryBeaconPosition::address, getOrAllocBeacon(), StationaryBeaconPosition::highResolution, MarvelmindHedge::positionsBeacons, StationaryBeaconsPositions::updated, StationaryBeaconPosition::x, StationaryBeaconPosition::y, and StationaryBeaconPosition::z.
Referenced by Marvelmind_Thread_().


|
static |
Definition at line 450 of file marvelmind.c.
References FusionIMUValue::ax, FusionIMUValue::ay, FusionIMUValue::az, MarvelmindHedge::fusionIMU, get_int16(), get_int32(), get_uint32(), FusionIMUValue::qw, FusionIMUValue::qx, FusionIMUValue::qy, FusionIMUValue::qz, FusionIMUValue::timestamp, FusionIMUValue::updated, FusionIMUValue::vx, FusionIMUValue::vy, FusionIMUValue::vz, FusionIMUValue::x, FusionIMUValue::y, and FusionIMUValue::z.
Referenced by Marvelmind_Thread_().


|
static |
Definition at line 428 of file marvelmind.c.
References RawIMUValue::acc_x, RawIMUValue::acc_y, RawIMUValue::acc_z, RawIMUValue::compass_x, RawIMUValue::compass_y, RawIMUValue::compass_z, get_int16(), get_uint32(), RawIMUValue::gyro_x, RawIMUValue::gyro_y, RawIMUValue::gyro_z, MarvelmindHedge::rawIMU, RawIMUValue::timestamp, and RawIMUValue::updated.
Referenced by Marvelmind_Thread_().


|
static |
Definition at line 260 of file marvelmind.c.
References PositionValue::address, PositionValue::angle, PositionValue::highResolution, markPositionReady(), PositionValue::timestamp, PositionValue::x, PositionValue::y, and PositionValue::z.
Referenced by Marvelmind_Thread_().


|
static |
Definition at line 294 of file marvelmind.c.
References PositionValue::address, PositionValue::angle, PositionValue::highResolution, markPositionReady(), PositionValue::timestamp, PositionValue::x, PositionValue::y, and PositionValue::z.
Referenced by Marvelmind_Thread_().


|
static |
Definition at line 475 of file marvelmind.c.
References RawDistanceItem::address_beacon, RawDistances::address_hedge, RawDistanceItem::distance, RawDistances::distances, get_uint32(), MarvelmindHedge::rawDistances, and RawDistances::updated.
Referenced by Marvelmind_Thread_().


| void startMarvelmindHedge | ( | struct MarvelmindHedge * | hedge | ) |
Definition at line 718 of file marvelmind.c.
References Marvelmind_Thread_(), MAX_BUFFERED_POSITIONS, StationaryBeaconsPositions::numBeacons, MarvelmindHedge::positionBuffer, MarvelmindHedge::positionsBeacons, PositionValue::processed, PositionValue::ready, MarvelmindHedge::terminationRequired, MarvelmindHedge::thread_, StationaryBeaconsPositions::updated, and MarvelmindHedge::verbose.
Referenced by MMNode::MMNode().


| void stopMarvelmindHedge | ( | struct MarvelmindHedge * | hedge | ) |
Definition at line 1062 of file marvelmind.c.
References MarvelmindHedge::terminationRequired, MarvelmindHedge::thread_, and MarvelmindHedge::verbose.