Skip to content

Commit

Permalink
Merge branch 'release/v1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jun 3, 2020
2 parents cd835a3 + 6eaa885 commit 0fb50ce
Show file tree
Hide file tree
Showing 34 changed files with 2,873 additions and 162 deletions.
2 changes: 1 addition & 1 deletion examples/OpenIMU300RI/IMU/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ platform = aceinna_imu
lib_archive = false
board = OpenIMU300
;lib_deps = ../../openIMU300-lib/openIMU300-lib
lib_deps = [email protected].6
lib_deps = OpenIMU300-base-library@~1.1.8
build_flags =
; -D CLI
-D SAE_J1939
Expand Down
2 changes: 1 addition & 1 deletion examples/OpenIMU300RI/IMU/src/appVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License.
#ifndef _IMU_APP_VERSION_H
#define _IMU_APP_VERSION_H

#define APP_VERSION_STRING "IMU_J1939 1.1.3"
#define APP_VERSION_STRING "IMU_J1939 1.1.4"


#endif
4 changes: 2 additions & 2 deletions examples/OpenIMU300RI/IMU/src/user/UserMessagingCAN.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ void ProcessRequest(void *dsc)
}
// pasket type request
else if ((req_ps_val == gEcuConfigPtr->packet_type_ps)) {
aceinna_j1939_send_packet_rate(gEcuConfigPtr->packet_type);
aceinna_j1939_send_packet_type(gEcuConfigPtr->packet_type);
}
// filter settings request
else if ((req_ps_val == gEcuConfigPtr->digital_filter_ps)) {
aceinna_j1939_send_digital_filter(gEcuConfigPtr->accel_cut_off, gEcuConfigPtr->rate_cut_off);
}
// orientation settings request
else if ((req_ps_val == gEcuConfigPtr->orien_bits)) {
else if ((req_ps_val == gEcuConfigPtr->orientation_ps)) {
uint8_t bytes[2];
bytes[0] = (gEcuConfigPtr->orien_bits >> 8) & 0xff;
bytes[1] = (gEcuConfigPtr->orien_bits) & 0xff;
Expand Down
4 changes: 2 additions & 2 deletions examples/OpenIMU300RI/INS/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ description = A Kalman filter based algorithm that uses rate-sensors to propagat
platform = aceinna_imu
lib_archive = false
board = OpenIMU300
;lib_deps = ../../openIMU300-lib\openIMU300-lib
lib_deps = [email protected].6
;lib_deps = ../../../../../openIMU300-lib/openIMU300-lib
lib_deps = OpenIMU300-base-library@~1.1.8
build_flags =
-D GPS
-D GPS_OVER_CAN
Expand Down
2 changes: 1 addition & 1 deletion examples/OpenIMU300RI/INS/src/appVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License.
#ifndef _IMU_APP_VERSION_H
#define _IMU_APP_VERSION_H

#define APP_VERSION_STRING "INS_J1939 1.0.3"
#define APP_VERSION_STRING "INS_J1939 1.0.4"


#endif
13 changes: 7 additions & 6 deletions examples/OpenIMU300RI/INS/src/user/UserMessagingCAN.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void ProcessRequest(void *dsc)
aceinna_j1939_send_digital_filter(gEcuConfigPtr->accel_cut_off, gEcuConfigPtr->rate_cut_off);
}
// orientation settings request
else if ((req_ps_val == gEcuConfigPtr->orien_bits)) {
else if ((req_ps_val == gEcuConfigPtr->orientation_ps)) {
uint8_t bytes[2];
bytes[0] = (gEcuConfigPtr->orien_bits >> 8) & 0xff;
bytes[1] = (gEcuConfigPtr->orien_bits) & 0xff;
Expand All @@ -183,11 +183,11 @@ void ProcessRequest(void *dsc)
void ProcessVehiclePosition(struct sae_j1939_rx_desc *desc)
{
GPS_DATA *posData = (GPS_DATA*)desc->rx_buffer.Data;
canInputNavParams.latitude = (double)posData->latitude*0.000001 - 210; // degrees
canInputNavParams.longitude = (double)posData->longitude*0.000001 - 210; // degrees
canInputNavParams.latitude = (double)posData->latitude*0.0000001 - 210; // degrees
canInputNavParams.longitude = (double)posData->longitude*0.0000001 - 210; // degrees
canInputNavParams.status |= J1939_GPS_POSITION_DATA_UPDATED;
gCanGps.latitude = (double)posData->latitude*0.000001 - 210; // degrees
gCanGps.longitude = (double)posData->longitude*0.000001 - 210; // degrees
gCanGps.latitude = (double)posData->latitude*0.0000001 - 210; // degrees
gCanGps.longitude = (double)posData->longitude*0.0000001 - 210; // degrees
}

void ProcessWheelSpeed(struct sae_j1939_rx_desc *desc)
Expand Down Expand Up @@ -360,6 +360,7 @@ void EnqeuePeriodicDataPackets(int latency, int sendPeriodicPackets)
}

// ss2 packets supported by 9DOF
#ifndef GPS_OVER_CAN
if (packets_to_send & ACEINNA_SAE_J1939_PACKET_LATLONG) {
GPS_DATA gpsData;

Expand All @@ -375,7 +376,7 @@ void EnqeuePeriodicDataPackets(int latency, int sendPeriodicPackets)

aceinna_j1939_send_GPS(&gpsData);
}

#endif

// acceleration packets
if (packets_to_send & ACEINNA_SAE_J1939_PACKET_ACCELERATION) {
Expand Down
2 changes: 1 addition & 1 deletion examples/OpenIMU300RI/VG_AHRS/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ platform = aceinna_imu
lib_archive = false
board = OpenIMU300
;lib_deps = ../../openIMU300-lib/openIMU300-lib
lib_deps = [email protected].6
lib_deps = OpenIMU300-base-library@~1.1.8
build_flags =
; -D CLI
; Comment next line for VG algorithm
Expand Down
4 changes: 2 additions & 2 deletions examples/OpenIMU300RI/VG_AHRS/src/user/UserMessagingCAN.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ void ProcessRequest(void *dsc)
}
// pasket type request
else if ((req_ps_val == gEcuConfigPtr->packet_type_ps)) {
aceinna_j1939_send_packet_rate(gEcuConfigPtr->packet_type);
aceinna_j1939_send_packet_type(gEcuConfigPtr->packet_type);
}
// filter settings request
else if ((req_ps_val == gEcuConfigPtr->digital_filter_ps)) {
aceinna_j1939_send_digital_filter(gEcuConfigPtr->accel_cut_off, gEcuConfigPtr->rate_cut_off);
}
// orientation settings request
else if ((req_ps_val == gEcuConfigPtr->orien_bits)) {
else if ((req_ps_val == gEcuConfigPtr->orientation_ps)) {
uint8_t bytes[2];
bytes[0] = (gEcuConfigPtr->orien_bits >> 8) & 0xff;
bytes[1] = (gEcuConfigPtr->orien_bits) & 0xff;
Expand Down
2 changes: 1 addition & 1 deletion examples/OpenRTK330LI/RAWDATA/include/app_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License.
#ifndef _APP_VERSION_H
#define _APP_VERSION_H

#define APP_VERSION_STRING "OpenRTK330L RAWDATA App 0.1.1"
#define APP_VERSION_STRING "OpenRTK330L RAWDATA App 1.1.1"

#define PRODUCT_NAME_STRING "OpenRTK330L"

Expand Down
4 changes: 3 additions & 1 deletion examples/OpenRTK330LI/RAWDATA/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ description =
platform = aceinna_imu
board = OpenRTK
lib_archive = false
lib_deps = [email protected]

lib_deps = [email protected]

build_flags =

-D STM32F469xx
Expand Down
16 changes: 9 additions & 7 deletions examples/OpenRTK330LI/RAWDATA/src/gnss_data_acq_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ limitations under the License.

#include "gnss_data_api.h"
#include "uart.h"
#include "bt_packet.h"
#include "ntrip_client.h"
#include "led.h"

Expand Down Expand Up @@ -63,8 +64,10 @@ static void _handleGpsMessages(uint8_t *RtcmBuff, int length)
base_cnt ++;
if(base_cnt > 200)
{
LED_RTCM_OFF; //No base station signal, led2 off
/* If no base station signal, RED LED is off */
LED_RTCM_OFF;
}

while (length)
{
length--;
Expand Down Expand Up @@ -106,10 +109,10 @@ static void _handleGpsMessages(uint8_t *RtcmBuff, int length)
uint8_t res = osSemaphoreWait(g_sem_rtk_finish, 0);
if (res == osOK && gnss_signal_flag)
{
g_ptr_gnss_data->rov = *obs;
g_ptr_gnss_data->ref = *(rtcm->obs + BASE);
g_ptr_gnss_data->nav = rtcm->nav;
osSemaphoreRelease(g_sem_rtk_start);
g_ptr_gnss_data->rov = *obs;
g_ptr_gnss_data->ref = *(rtcm->obs + BASE);
g_ptr_gnss_data->nav = rtcm->nav;
osSemaphoreRelease(g_sem_rtk_start);
}
}
}
Expand Down Expand Up @@ -139,12 +142,11 @@ void GnssDataAcqTask(void const *argument)
{
int BtLen = 0;
BtLen = uart_read_bytes(UART_BT, bt_buff, GPS_BUFF_SIZE, 0);

if (BtLen)
{
if(uart_sem_wait(UART_BT,0) == RTK_SEM_OK)
{
//ret = bt_uart_parse(bt_buff);
ret = bt_uart_parse(bt_buff);
}
if (ret != RTK_JSON)
{
Expand Down
2 changes: 0 additions & 2 deletions examples/OpenRTK330LI/RAWDATA/src/imu_data_acq_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ void TaskDataAcquisition(void const *argument)
res = InitSensors();
InitSensorsData();

configSetPacketRate(100, TRUE);

while (1)
{
//UBaseType_t uxHighWaterMark;
Expand Down
2 changes: 2 additions & 0 deletions examples/OpenRTK330LI/RAWDATA/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ int main(void)
uart_driver_install(UART_GPS,&uart_gps_rx_fifo,&huart_gps,460800);
uart_driver_install(UART_BT,&uart_bt_rx_fifo,&huart_bt,460800);

delay_ms(10000); //Delay, in case the usb driver is not installed on computer

ResetForEnterBootMode(); // normal or iap mode

InitFactoryCalibration();
Expand Down
103 changes: 78 additions & 25 deletions examples/OpenRTK330LI/RAWDATA/src/rtk_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,69 @@ limitations under the License.*/
#include "led.h"
#include "ntrip_client.h"
#include "utils.h"
#include "nav_math.h"

extern gnss_raw_data_t *g_ptr_gnss_data;


static void RTKAlgorithm(void);
gnss_solution_t g_gnss_sol = {0};

char gga_buff[200] = "$GPGGA,,,N,,E,,,,,M,,M,,*\r\n";


/** ***************************************************************************
* @name copy_pvt_result()
* @brief store PVT result to the global PVT struct
* @param in: rover PVT [ST internal; RTK algorithm output; INS algorithm output]
* out: gnss solution
* @retval N/A
******************************************************************************/
static void copy_pvt_result(const st_pvt_type999_t* rov, gnss_solution_t* gnss_sol)
{
double blh[3] = {0};

if (gnss_sol != NULL)
{
ecef2pos(rov->pos_xyz, blh);
gnss_sol->gps_week = rov->ext_gps_week_number;
gnss_sol->gps_tow = (uint32_t)(rov->gnss_epoch_time);
gnss_sol->latitude = blh[0];
gnss_sol->longitude = blh[1];
gnss_sol->height = blh[2];

memcpy(gnss_sol->pos_ecef, rov->pos_xyz, 3*sizeof(double));

double C_en[3][3] = { {0.0} }, vel[3];
blh2C_en(blh, C_en);
for (int i = 0; i < 3; ++i) {
gnss_sol->vel_ned[i] = 0.0f;
for (int j = 0; j < 3; ++j) {
gnss_sol->vel_ned[i] += C_en[i][j]*rov->vel_xyz[j];
}
}

gnss_sol->sol_age = 0.0;

gnss_sol->num_sats = rov->num_sat_in_use;
gnss_sol->gnss_fix_type = 1;
gnss_sol->dops[2] = rov->hdop;
gnss_sol->gnss_update = 1;
}
}

/** ***************************************************************************
* @name rtk_algorithm()
* @brief GNSS RTK algorithm entry
* Rover and base data are stored in g_ptr_gnss_data
* nav_t *nav = &g_ptr_gnss_data->nav;
* obs_t *rov = &g_ptr_gnss_data->rov;
* @param N/A
* @retval N/A
******************************************************************************/
static void rtk_algorithm(void)
{

}

/** ***************************************************************************
* @name RTKTask()
* @brief RTK Algorithm task
Expand All @@ -46,7 +101,6 @@ void RTKTask(void const *argument)
{
// UBaseType_t uxHighWaterMark;
// uxHighWaterMark = uxTaskGetStackHighWaterMark(NULL);
obs_t* ptr_rover_obs = &g_ptr_gnss_data->rtcm.obs[0];

uint8_t res = osSemaphoreWait(g_sem_rtk_start, 0);
while (1)
Expand All @@ -61,34 +115,33 @@ void RTKTask(void const *argument)
}
LED1_Toggle();

RTKAlgorithm();
rtk_algorithm();

// use rover obs to make gga and pull base rtcm data
print_pos_gga_util(ptr_rover_obs->time, ptr_rover_obs->pos, ptr_rover_obs->n, 1, 1.0, 0.0, gga_buff);
/* use ST internal SPP solution as an example for GNSS PVT solution
* For User reference, copy your RTK PVT to g_gnss_sol struct
*/
st_pvt_type999_t* st_pvt = &g_ptr_gnss_data->rtcm.rcv[ROVER].st_pvt;
if (st_pvt->flag_gnss_update) {
copy_pvt_result(st_pvt, &g_gnss_sol);

//uart_write_bytes(UART_DEBUG, gga_buff, strlen(gga_buff), 1);
//send gga from Bluetooth
uart_write_bytes(UART_BT, gga_buff, strlen(gga_buff), 1);
//send gga from Internet
ntrip_push_tx_data((uint8_t*)gga_buff, strlen(gga_buff));
/* use rover position to make NMEA GGA message and pull base rtcm data */
gtime_t time = gpst2time(g_gnss_sol.gps_week, g_gnss_sol.gps_tow*0.001);
print_pos_gga(time, g_gnss_sol.pos_ecef, g_gnss_sol.num_sats, g_gnss_sol.gnss_fix_type, g_gnss_sol.dops[2], g_gnss_sol.sol_age, gga_buff);

/* send NMEA GGA position to NTRIP server using Bluetooth */
uart_write_bytes(UART_BT, gga_buff, strlen(gga_buff), 1);
/* send NMEA GGA position to NTRIP server using Ethernet */
ntrip_push_tx_data((uint8_t*)gga_buff, strlen(gga_buff));

st_pvt->flag_gnss_update = 0;
}
else {
g_gnss_sol.gnss_update = 0;
}

osSemaphoreRelease(g_sem_rtk_finish);

// uxHighWaterMark = uxTaskGetStackHighWaterMark(NULL);
// printf("uxhigh=%d\r\n",TASKRTD_STACK-uxHighWaterMark);
}
}

/** ***************************************************************************
* @name RTKAlgorithm()
* @brief RTK Algorithm
* Rover and base data are stored in g_ptr_gnss_data
* nav_t *nav = &g_ptr_gnss_data->nav;
* obs_t *rov = &g_ptr_gnss_data->rov;
* @param N/A
* @retval N/A
******************************************************************************/
static void RTKAlgorithm(void)
{

}
Loading

0 comments on commit 0fb50ce

Please sign in to comment.