Coder Social home page Coder Social logo

hyped-2022's People

Contributors

adenhaus avatar arjunnaha avatar brano2 avatar callumtm avatar dhamedbarghi avatar donaldjennings avatar efe-ozbatur avatar flori-margaritescu avatar freddiejbawden avatar gregorydayao12 avatar hur avatar iainmacpherson avatar jamesridley avatar justusrudolph avatar kshxtij avatar martinkristien avatar maxguy2001 avatar mifrandir avatar mkristien avatar neilweidinger avatar pmorande27 avatar rachel275 avatar rachsomerset avatar robertasn avatar sashank17 avatar snickeyx avatar suryanshmanocha avatar thanakrit-anutrakulchai avatar tomlonergan03 avatar yining-wang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

orarix

hyped-2022's Issues

Set up a separte repository for the wiki

GitHub doesn't allow us to open PRs and issues on the wiki. One way to avoid this seems to be to create a mirror repository with a GitHub action that allows us to push to the wiki (and maybe do dynamic re-linking) upon new commits to master. This may be possible through GitHub actions.

Polish Propulsion

All files need checked for basic issues

Files assigned:

Unassigned:

GUI default graphs

Graphs on the left of the GUI need to be manually selected every time it runs. Graphs should appear by default instead.

Remove header comments from all CPP files

Currently, every file has a comment at the top which gives general information like a description, the author and the licensing. While this is intended to be useful, it turns out that there is no point in keeping this.

  • To find the last edit date and the authors, git blame or GitHub are far more useful and accurate and don't require any human input.
  • The descriptions tend to be out of date or empty. Additionally, I would argue that such general documentation should be in the wiki.
  • The license can be put at the top level of the directory. Since any code is copyrighted by default, and licenses only weaken those restrictions, there is no requirement whatsoever to make "absolutely doubly sure" that whoever may read the code is aware of the licensing. If they want to use it, they have to be aware of the license.

Polish Telemetry

Fix basic issues in the following files. (Naming, typing, adding const, using namespace etc.)

No GUI terminal output when run with fake system

When the GUI is run with no fake system flags set, terminal output iOS displayed on the front end. However, when we run it with the fake system flags, there is no terminal output on the front end unless it errors out.

Investigate fully single-threaded setup

At the moment, the pod-side code makes heavy use of threading. This makes sense because we have different components that are quite independent. However, the BBB only has a single core so we cannot make use of any parallelism whatsoever.

Further, every module has a main loop that reruns the same logic over and over again. This means it is easy break up the code into chunks that can be run consecutively without blocking each other for too long. This should lead to a speedup because we don't need to rely on the OS to switch between the threads. Further, it will allow us to use callbacks. For example, some parts of the code currently use sleeps to account for mechanical actions, like engaging brakes. Consider the following fictional code:

engageBrakes();
Thread::sleep(1000);
if (!checkBrakesEngaged()) {
  criticalFaillure("Could not engage brakes");
}

This could be improved by using a central event queue as follows:

engageBrakes()
Core::schedule(1000, [&]{
  if (checkBrakesEngaged()) {
    criticalFailure("Could not engage brakes");
  }
});

This would have several advantages:

  1. Removes race conditions and make the program more deterministic.
  2. Allows for simple scheduling.
  3. Gives finer control in terms of priorities.
  4. Reduces thread overhead and scheduling costs.
  5. Allows us to get rid of singleton instances, e.g. for data and system.
  6. Allows to use (const) references and modifying/reading from those directly so we save on locking.
  7. Simplifies testing as we can verify properties of data after each iteration.
  8. Allows us to (eventually) get rid of check based code e.g. in State Machine. Instead, we could use updates directly as everything would be in the same thread so transitions could happen instantly after a change occurs.

GUI doesn't work with new JSON

#84 cannot be merged until mission-control-2022 works with the new json structure. Currently, nothing on the GUI shows when sent the new json and it seems like not all the json is being written to file by the server. Not sure if that's because it's not all being sent, or if there is a receiving/writing issue.

Polish Sensors

Assigned Files:

Unassigned Files:

  • imu_manager.cpp
  • imu_manager.hpp
  • interface.hpp
  • main.cpp
  • main.hpp
  • fake_batteries.cpp
  • fake_batteries.hpp
  • fake_gpio_counter.cpp
  • fake_gpio_counter.hpp
  • fake_gpio_counter.hpp
  • fake_imu.cpp
  • fake_imu.hpp
  • fake_temperature.cpp
  • fake_temperature.hpp

Migrate to CMake

Using a different build system has been discussed before. There are many reasons why we should use CMake instead of pure GNU Make:

  1. It's the industry standard and thus a tool worth getting used to.
  2. It's more transparent. Since it takes the builds to a higher level, it's easier to modify and manage.
  3. IDEs are able to load CMake projects and improve their support based on that.

We should also consider upgrading to C++20 and using Clang.

Remove raw pointers, add references, add const where possible

We are still using many raw pointers in places where they are not required. Raw pointers are difficult to analyse and should be avoided unless strictly necessary. If no pointer arithmetic is required and the reference itself does not have to be stored in a collection, references are sufficient.

Further, we should be using the const keyword as much as possible. While it does not make the code prettier, it does provide helpful compile-time guarantees which may allow us to avoid some bugs. Further, it gives the developers good insight into how certain values are used.

Rework loggers

Ideally, we would want to have a line like

static Logger log("STM", STM_LL);

Then we could remove the passing of loggers entirely. This would also allow us to set the log levels through CMake flags like so:

$ cmake .. -DSTM_LL=4

This has already been started here:

Logger log_(true, 0);

Weird logic in rpm_regulator.cpp

In RPM_Regulator::calculateRPM when the temperature is over the maximum temperature the output is to maintain current RPMs. This feels counterintuitive and needs confirmed whether it is correct behaviour.

if (act_temp <= MAX_TEMP) {
if (act_current < MAX_CURRENT && act_temp < MAX_TEMP && act_rpm < opt_rpm) {
return act_rpm + step(opt_rpm, true);
} else if (act_current > MAX_CURRENT || act_temp > MAX_TEMP || act_rpm > opt_rpm) {
int32_t target = act_rpm - step(opt_rpm, false);
if (target < 0) {
return 0;
} else {
return target;
}
} else {
return act_rpm;
}
} else {
return act_rpm;
}

Default case issue in gpio_manager.cpp

In gpio_manager.cpp, the default case could be triggered once the pod is in kCalibrating - but this would cause unnecessary critical failure. Is this intentional?

if (state != previous_state_) {
switch (state) {
case data::State::kIdle:
case data::State::kAccelerating:
case data::State::kCruising:
case data::State::kNominalBraking:
break;
case data::State::kEmergencyBraking:
case data::State::kFailureStopped:
clearHP();
log_.ERR("GPIO-MANAGER", "Emergency State! HP SSR cleared");
break;
case data::State::kFinished:
clearHP();
log_.INFO("GPIO-MANAGER", "kFinished reached...HP off");
break;
case data::State::kReady:
setHP();
log_.INFO("GPIO-MANAGER", "kReady...HP SSR set and HP on");
break;
default: // undefied behaviour, e.g. kInvalid
clearHP(); // shutting down HP asap
log_.ERR("GPIO-MANAGER", "Unknown State! HP SSR cleared, shutting down!");
// signalling failure to get out of undefied behaviour
data::Batteries batteries_data = data_.getBatteriesData();
batteries_data.module_status = data::ModuleStatus::kCriticalFailure;
data_.setBatteriesData(batteries_data);
break;
}
}

Remove all old NOLINT and TODO comments

There are some // NOLINT and // TODO comments in the source code. These should be removed.

In case of the TODOs we should decide whether or not they are still relevant and if that's the case create a corresponding issue.

Re-design fake systems to not rely on Sims

At the moment we require Sims to provide us with files containing sensor readings to test our software. This is problematic because once we change the pod's behaviour, e.g. by adding a state to the state machine, the sims data is off and we cannot simulate a run. This could be fixed by defining a ground truth displacement/velocity/acceleration curve that can then be used to generate sensor readings. This is close to what Sims are doing anyways so we can just rewrite their MATLAB code into a C++ component.

This could even incorporate motor controls as we could make the acceleration dependent on the motors and what they are currently doing.

In any case, Software should not rely on one particular pod design.

Rename embrakes to brakes

We are referring to the brakes as embrakes even though they are not just emergency brakes anymore. That should change.

Not all states displayed on GUI

New states which have recently been added aren't displayed bin the state section of the GUI. Support for these needs to be added on the front end.

Modernise STM to make use of const, references, optionals and unique pointers

For example the current version

State *Idle::checkTransition(Logger &log)
{
  updateModuleData();

  bool emergency = checkEmergency(log, embrakes_data_, nav_data_, batteries_data_, telemetry_data_,
                                  sensors_data_, motors_data_);
  if (emergency) { return FailureStopped::getInstance(); }

  bool calibrate_command = checkCalibrateCommand(log, telemetry_data_);
  if (!calibrate_command) { return nullptr; }

  bool all_initialised = checkModulesInitialised(log, embrakes_data_, nav_data_, batteries_data_,
                                                 telemetry_data_, sensors_data_, motors_data_);
  if (all_initialised) { return Calibrating::getInstance(); }

  return nullptr;
}

should be rewritten to

const State *Idle::checkTransition(Logger &log)
{
  updateModuleData();

  const bool emergency = checkEmergency(log, embrakes_data_, nav_data_, batteries_data_, telemetry_data_,
                                  sensors_data_, motors_data_);
  if (emergency) { return FailureStopped::getInstance(); }

  const bool calibrate_command = checkCalibrateCommand(log, telemetry_data_);
  if (!calibrate_command) { return nullptr; }

  const bool all_initialised = checkModulesInitialised(log, embrakes_data_, nav_data_, batteries_data_,
                                                 telemetry_data_, sensors_data_, motors_data_);
  if (all_initialised) { return Calibrating::getInstance(); }

  return nullptr;
}

Alternatives like

std::optional<std::unique_ptr<State>> Idle::checkTransition(Logger &log)

also seem possible.
Similarly, all transition functions should only use const references to the data objects.

mission-control-2022 Java cleanup

Cleaning up easy issues in Java and JavaScript files in mission-control-2022 repo. If you're using IntelliJ, it will suggest a couple of improvements for the Java files, for example. Scan through the files and if you see some obvious things you can fix, fix them, else leave it. No need to commit for the sake of committing.

Issues for mission-control-2022 will be opened here, but open your PR on the repo itself.

Java files in question are in mission-control-2022/src/main/java/server.

JavaScript files are in mission-control-2022/frontend/src.

  • App.js, ConfigManager.js, DataTools.js, index.js, serviceWorker.js - @sashank17

Missing batteries panel on GUI

In the screenshot of the GUI in the FDD there is a panel displaying battery info on the GUI. When we run it, this panel isn't visible.

Allow for manual testing binary

All of our software is designed to handle a full pod run. This obviously means that we don't have direct access to all the features the pod has to offer through manual controls for safety reasons. However, we will get into testing soon and we need to have a binary that allows us to do everything that we would want in such a setting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.