Skip to content

Emdrive float - #53

Open
cfallon61 wants to merge 66 commits into
masterfrom
emdrive_float
Open

Emdrive float#53
cfallon61 wants to merge 66 commits into
masterfrom
emdrive_float

Conversation

@cfallon61

Copy link
Copy Markdown
Member

holy cow our first merge to master in 2 years

mflanag and others added 30 commits October 13, 2018 11:11
…ller was writing to the wrong register. Need to investigate further what value to set the can timout too. Wheels do spin.
Takes high_cell_temp reading to limit based off of power. Relatively
arbitrary values were used.
Does the same for low_volt_cell and power output.

Changed the can filter on CAN1 to accept the BMS can message.
should have rinehart, lcd, and power lim
Matt
Merged traction control into power limiting branch (untested)
Matt
I think i fully integrated traction and power limiting
Matt
added an acknowledgement function and utilized it for all dashboard messages
Matt
No warnings perfect compile
Merged all rinehart_int changes back into the power_limiting code
Matt
power limiting algorithm tested and works correctly for simulated inputs.
Matt
percepio works and added them to gitignore
Comment thread Inc/BMS.h
#define HIGH_Temperature_BITS_0_7 0
#define HIGH_Temperature_BITS_11_8 1
#define LOW_Temperature_BITS_0_7 0
#define LOW_Temperature_BITS_0_7 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of space

Comment thread Inc/BMS.h
#define PACK_INST_VOLTAGE_BITS_0_7 0
#define PACK_INST_VOTLAGE_BITS_11_8 1

#define PACK_FULL_VOLTAGE 300

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should be part of EEPROM stuff now

Comment thread Inc/PedalBox.h

BRAKE_2_MIN = 0x026F,
BRAKE_2_MAX = 0x0900,
} Brake_Thresholds_t;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brakes and throttle would be great values to store in eeprom.

You could also potentially save config files on PI and transfer them over on boot but that seems more hacky.

Comment thread Inc/PedalBox.h
PEDALBOX_STATUS_ERROR_APPSIMP = 0b00000100, //APPS Implausibility error, EV 2.3.5,
PEDALBOX_STATUS_ERROR_APPSIMP_PREV = 0b00001000, //APPS Implausibility error, provisional (before it has lasted .1 second)
PEDALBOX_STATUS_ERROR_BPIMP = 0b00010000, //brake pedal implaus //EV 2.5.1,
} Pedalbox_status_t;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using bitfields

Comment thread Inc/emdrive.h
MOTOR_FEEDBACK_ERR = 0xFF0B,
DC_LINK_UNDER_VOLT_ERR = 0xFF0C ,
PULS_MODE_FINISHED_ERR = 0xFF0D,
EMRGNCY_BUTT_PRSD_ERR = 0xFF0E,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use hex here??

Comment thread Inc/emdrive.h
REMOTE = 8,
TARGET_REACHED = 10,
INTERNAL_LIMIT_ACTIVE = 11,
} status_word_masks_t;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't really masks...

Comment thread Inc/imu.h
#define IMU_16G 4
#define IMU_ACCEL 0
#define IMU_8G_VAL 0x3FFF
#define IMU_8G_NEG 0xC001 //negative 0x3FFF

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line these up

Comment thread Inc/BMS.h
{
// TODO possibly make this be values ORed together
NO_FAULT = 0,
OVER_POWER_FAULT = 1,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old code

Comment thread Inc/BMS.h
typedef struct
{
BMS_Fault_t fault; //flag that tells what limit was broken 1 -> Power, 2 -> Temp, 3 -> Volt
uint8_t pack_soc; //pack SOC

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More precision

Comment thread Inc/CANProcess.h
void processBamoCar(CanRxMsgTypeDef* rx);
void processWheelModuleFrame(CanRxMsgTypeDef* rx);
void processPedalboxFrame(CanRxMsgTypeDef* rx);
//void processPedalboxFrame(CanRxMsgTypeDef* rx);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't exist

Comment thread Inc/CAN_Bus.h
#ifndef CAN_BUS_H
#define CAN_BUS_H

#include "stm32f4xx_hal.h"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably just use stdint.h

Comment thread Inc/CAN_Bus.h

typedef enum
{
ID_RINEHART_STATION_TX = 0x069,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing

Comment thread Src/car.c Outdated
torque_to_send = TractionControl(current_time_ms, &last_time_tc, torque_to_send, &int_term_tc, &prev_trq_tc);
}

emdrive_move_the_car_yo((emdrive_t *) &car.emdrive, torque_to_send, (CAN_Bus_TypeDef *) &car.vcan);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't actually move the car 👎🏻

Comment thread Src/car.c

emdrive_move_the_car_yo((emdrive_t *) &car.emdrive, torque_to_send, (CAN_Bus_TypeDef *) &car.vcan);
//wait until Constant 50 Hz rate
vTaskDelayUntil(&current_tick_time, PERIOD_TORQUE_SEND);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No wait here

Comment thread Src/car.c
//wait until Constant 50 Hz rate
vTaskDelayUntil(&current_tick_time, PERIOD_TORQUE_SEND);
}
vTaskDelayUntil(&current_tick_time, pdMS_TO_TICKS(1));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have full wait time (50 ms) here

Comment thread Src/car.c
vTaskDelayUntil(&current_tick_time, pdMS_TO_TICKS(1));
}

vTaskDelete(NULL);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Comment thread Src/car.c
tx.Data[0] = val;

xQueueSendToBack(car.dcan.q_tx, &tx, 100);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants