Code Monkey home page Code Monkey logo

wolfiemouse's Introduction

WolfieMouse

WolfieMouse is a robotics project to build a micromouse. This project covers three parts:

  • Robotics algorithm for maze solving (C++)
  • low-level hardware driver software (C and ARM assembly)
  • Tools to capture and plot robot's sensor data (Python)
  • Embedded hardware design and PCB design (KiCad, an open-source alternative to Altium)

This robot won:

  • The Special Mention Award in 2018 IEEE Region 1 Micromouse Robotics Competition.
  • The 3rd Place Award in 2019 IEEE Region 1 Micromouse Robotics Competition.

Get started

If you don't know what is micromouse competition, this document will help..

Requires tools:

Otherwise, a Vagrant virtual machine environment is provided to skip installing the above tools.

If you whish to start with this project, see get stared document.

Documentation

See documentation section.

Directory descriptions

  • doc: Documentation folder
  • firmware: The robot's program folder, including robotics algorithms and hardware drivers
  • simulation: Programs to test algorithms on a desktop computer
  • tools: Contains robot sensor data capturing tools and scripts for Vagrant machine.

Gallery

Terminal-based simulation program. M stands for the position of the robot, D stands for the position of the goal in the maze, and S stands for the starting position.

simulation

Schematic overview.

schematic_overview

PCB Footprint overview.

pcb_overview

License and Credits

Source code in firmware and simulation folders are licensed under GPLv2.1.

External libraries (FreeRTOS, CMSIS, STM32F4 HAL) under firmware/lib follow their own terms.

The fundamental hardware design is inspired by Project Futura by Green Ye.

wolfiemouse's People

Contributors

gitter-badger avatar gonzagab avatar hyunsoochoi0215 avatar kbumsik avatar luciana19 avatar sbuericlu avatar yushan233 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wolfiemouse's Issues

Adding the new hardware driver.

I already wrote the hardware driver. We only need to integrate it.

  • : Add a simple blinky project
  • : Make test prjects for each hardware component.
  • : Add PID-controlled motor driver.
  • : implement finderInterface and moverInterface integrating hardware driver.

Adding logger breaks real-time constraints

It appears that using logger_log() will delay the control_loop thread so that PID loop does is not triggered on time.
It looks like there is a problem with context switching.

Add Hardware Design documentation

Hardware Design is already added in doc branch. But it is completely separated from master branch. Let's merge the design into new_doc branch.

Add `IOInterface` class and `StdIO`

I have added a class diagram for future reference. This point is providing interface class to easily switch between simulation and real mouse hardware and provide various interface for communication. I believe @gonzagab already knows how much implemented so far.

In this step, we are going to make IOInterface class and its implementation, StdIO (IO means Input/Output. and Std implies standard library). To do this, we need to change at least MazeIO's contructor, MazeIO::loadMaze(), and MazeIO::writeFileFromBuffer(). IOInterface may look like this:

class IOInterface
{
private:
    FILE *file;
public:
    // replacement for fopen()
    virtual void open(char *filename, char *mode) = 0;
    // replacement for fgetc()
    virtual int getc() = 0;
    // replacement for fwrite()
    virtual size_t write(const void *ptr, size_t size, size_t nmemb) = 0;
}

C++ has something similar to Interface class called Abstract Base Class.

If you have a question, ask here.

Documentation

  • : README in the project page
  • : Documentation update in doc folder
  • : License and credit
  • : License in the source code

Compile Error with mazeString

Dear Bunsik,

Thanks for you Great work!

I have up and running vagrant VM and could reach before make

But have problem with make.

Could you give me any hint to solve this problem?

BTW, windows 11 will not allow us to install VirtualBox.

main.cc: In function 'void task_1_mouse_simulation()':
main.cc:66:68: error: 'mazeString' was not declared in this scope
static SimulMouse virtualMouse(const_cast<Maze::StringMaze >(&mazeString), &fakeIO, &fakeIO);
^~~~~~~~~~
main.cc: In function 'int main()':
main.cc:286:52: warning: ISO C++ forbids converting a string constant to 'char
' [-Wwrite-strings]
terminal_puts("Creating main task failed!!");
^
../target.mk:22: recipe for target 'build/main.o' failed
make: *** [build/main.o] Error 1
make 8.00s user 15.96s system 41% cpu 58.070 total

Display Mouse's direction

Currently M is displayed to indicate the position of the mouse in terminal. It would be better when we see current direction of the mouse.
However, ASCII code does not have arrows (e.g. ↑,↓,←,→) so we cannot print them.
Instead we could print U D L R to show direction. Maybe we can come up a better solution like -> and <-.

Dynamic position of goal in maze

@gonzagab
Currently we have maze of fixed 16x16, as we specified using #define. But we have a smaller maze in IEEE lab, This is okay in our code structure as the border of the maze will be considered as 'blocked wall' anyway and we can draw like that in the simulation. The problem is the position of goal is also fixed.
We should be able to define the position of goal using marking G in the maze file.

If anyone have question on the issue and our software. Just ask me here by commenting!

Algorithm problem

There is defect on simulation result simulation/maze_solver. We need to figure out why.

Algorithm is not truly shortest path.

When the goal is surrounded by cells that have not been searched yet, the mouse will not actually take the shortest. The mouse will move to the left until it cannot. Then up and then right towards the goal.

 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ 
|  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  |
 ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** 
|  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * G|
 ** ** ** ** ** ** ** __ ** ** ** ** ** ** ** ** 
|  *  *  *  *  *  *  |  |  *  *  *  *  *  *  *  |
 __ __ __ __ __ __ __ .. ** ** ** ** ** ** ** ** 
|  .  .  .  .  .  .  .  |  *  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ __ ** ** ** ** ** ** ** 
|  |  .  .  .  .  .  .  |  |  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ .. ** ** ** ** ** ** ** 
|  |  .  .  .  .  .  .  .  |  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ .. ** ** ** ** ** ** ** 
|  |  |  *  *  *  *  *  |  |  *  *  *  *  *  *  |
 .. .. ** ** ** ** ** __ .. ** ** ** ** ** ** ** 
|  |  |  *  *  *  *  |  .  |  *  *  *  *  *  *  |
 .. .. ** ** ** __ __ .. .. __ __ __ .. ** ** ** 
|  |  |  *  *  |  .  .  .  |  .  .  .  |  *  *  |
 .. .. __ __ __ .. __ __ __ __ __ __ .. ** ** ** 
|  |  .  .  .  |  .  .  .  .  |  .  |  |  *  *  |
 .. __ __ __ .. .. __ __ __ .. __ __ .. ** ** ** 
|  .  .  .  |  |  |  .  .  |  .  .  .  |  *  *  |
 __ __ __ .. .. .. __ __ __ .. __ __ .. ** ** ** 
|  .  .  .  |  |  .  .  .  .  .  .  |  |  *  *  |
 .. __ __ __ .. __ __ __ __ __ __ __ .. ** ** ** 
|  .  .  .  |  .  .  .  .  .  .  .  .  |  *  *  |
 __ __ __ __ .. __ __ __ __ __ __ __ __ ** ** ** 
|  .  .  .  .  |  *  *  *  *  |  .  |  *  *  *  |
 .. .. __ __ __ ** ** ** ** ** .. .. ** ** ** ** 
|  |  |  *  *  *  *  *  *  *  |  |  |  *  *  *  |
 .. .. __ __ __ __ __ __ __ __ .. __ ** ** ** ** 
| S|  .  .  .  .  .  .  .  .  .  |  *  *  *  *  |
 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ 

Remove isMouse in Cell struct

isMouse member in Cell struct is used to indicate if there is a mouse on it. However, in our design Cells are not supposed to contain presence of the mouse, since MouseController has information of the mouse position already.
The MouseController class has the position information, inheriting from PositionController class.

I initially used isMouse member to Cell struct due to printing problem - And I fixed that problem by adopting MazeIO class. MouseController still should be able to print where the mouse is after removing isMouse.

Support for multiple, flexible goals.

This program only supports a single static goal. However, there are 4 goals in the competition.

On top of that, when you look for some Micromouse video, you can see patterns of the micromouse:

  1. Search for cell while trying to reach to the goal.
  2. After getting to the goal, it look for unsearched cells and then go back to the starting point.
  3. Then drive to the goal directly as fast as the mouse can.

This implies we need to introduce destination variable that can be changed during running.
To summarize:

  • Add support for multiple goals. The algorithm implementation should also be fixed accordingly.
  • Add Destinations property in MouseController class. Also add getter and setter methods for Destination. MouseController class should not use Goals directly, and make use of Destinations instead. The program should support multiple Destinations as well.

Ask me about designing this anytime. I will work for hardware driver for a week.

Double the size of cell when print

Our maze currently prints only a single character size cells. But it restricts expression our algorithms.
So we need to increase the size. Here is how our sample maze should look like (it replaces a file simulation/1.txt

 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ 
|  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  |
 ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** 
|  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  |
 ** ** ** ** ** ** ** __ ** ** ** ** ** ** ** ** 
|  *  *  *  *  *  *  |  |  *  *  *  *  *  *  *  |
 __ __ __ __ __ __ __ .. ** ** ** ** ** ** ** ** 
|  .  .  .  .  .  .  .  |  *  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ __ ** ** ** ** ** ** ** 
|  |  .  .  .  .  .  .  |  |  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ .. ** ** ** ** ** ** ** 
|  |  .  .  .  .  .  .  .  |  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ .. ** ** ** ** ** ** ** 
|  |  |  *  *  *  *  *  |  |  *  *  *  *  *  *  |
 .. .. ** ** ** ** ** __ .. ** ** ** ** ** ** ** 
|  |  |  *  *  *  *  |G .G |  *  *  *  *  *  *  |
 .. .. ** ** ** __ __ .. .. __ __ __ __ ** ** ** 
|  |  |  *  *  |  .  .G .G |  .  .  .  |  *  *  |
 .. .. __ __ __ .. __ __ __ __ __ __ .. ** ** ** 
|  |  .  .  .  |  .  .  .  .  |  .  |  |  *  *  |
 .. __ __ __ .. .. __ __ __ .. __ __ .. ** ** ** 
|  .  .  .  |  |  |  .  .  |  .  .  .  |  *  *  |
 __ __ __ .. .. .. __ __ __ .. __ __ .. ** ** ** 
|  .  .  .  |  |  .  .  .  .  .  .  |  |  *  *  |
 .. __ __ __ .. __ __ __ __ __ __ __ .. ** ** ** 
|  .  .  .  |  .  .  .  .  .  .  .  .  |  *  *  |
 __ __ __ __ .. __ __ __ __ __ __ __ __ ** ** ** 
|  .  .  .  .  |  *  *  *  *  |  .  |  *  *  *  |
 .. .. __ __ __ ** ** ** ** ** .. .. ** ** ** ** 
|  |  |  *  *  *  *  *  *  *  |  |  |  *  *  *  |
 .. .. __ __ __ __ __ __ __ __ .. __ ** ** ** ** 
|S |  .  .  .  .  .  .  .  .  .  |  *  *  *  *  |
 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ 

And when print with distance:

 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ 
|  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  |
 ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** 
|  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  |
 ** ** ** ** ** ** ** __ ** ** ** ** ** ** ** ** 
|  *  *  *  *  *  *  |  |  *  *  *  *  *  *  *  |
 __ __ __ __ __ __ __ .. ** ** ** ** ** ** ** ** 
|  .  .  .  .  .  .  .  |  *  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ __ ** ** ** ** ** ** ** 
|  |  .  .  .  .  .  .  |  |  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ .. ** ** ** ** ** ** ** 
|  |  .  .  .  .  .  .  .  |  *  *  *  *  *  *  |
 .. .. __ __ __ __ __ __ .. ** ** ** ** ** ** ** 
|  |  |  *  *  *  *  *  |  |  *  *  *  *  *  *  |
 .. .. ** ** ** ** ** __ .. ** ** ** ** ** ** ** 
|  |15|  *  *  *  *  |G .G |  *  *  *  *  *  *  |
 .. .. ** ** ** __ __ .. .. __ __ __ __ ** ** ** 
|  |14|  *  *  |  .  .G .G |  .  .  .  |  *  *  |
 .. .. __ __ __ .. __ __ __ __ __ __ .. ** ** ** 
|  |13.12.11.10|  .  .  .  .  |  .  |  |  *  *  |
 .. __ __ __ .. .. __ __ __ .. __ __ .. ** ** ** 
|  .  .  .  |9 |  |  .  .  |  .  .  .  |  *  *  |
 __ __ __ .. .. .. __ __ __ .. __ __ .. ** ** ** 
|  .  .  .  |8 |  .  .  .  .  .  .  |  |  *  *  |
 .. __ __ __ .. __ __ __ __ __ __ __ .. ** ** ** 
|  .  .  .  |7 .  .  .  .  .  .  .  .  |  *  *  |
 __ __ __ __ .. __ __ __ __ __ __ __ __ ** ** ** 
|2 .3 .4 .5 .6 |  *  *  *  *  |  .  |  *  *  *  |
 .. .. __ __ __ ** ** ** ** ** .. .. ** ** ** ** 
|1 |  |  *  *  *  *  *  *  *  |  |  |  *  *  *  |
 .. .. __ __ __ __ __ __ __ __ .. __ ** ** ** ** 
|S |  .  .  .  .  .  .  .  .  .  |  *  *  *  *  |
 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ 

Make use of C++11

  • change char* to std::string
  • Abandon Queue class. Use std::deque.
  • Others...

Hardware driver improvements

Here are problems:

  • : Uninitialized variables (.bss) is too much (almost 100k!)
  • : Encoder is a little bit low-resolution. (around 200/rev) Speed is often measured in 0mm/s because our algorithm updates the encoder ever 1ms

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.