diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c7b49ee --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Arduino/libraries/* \ No newline at end of file diff --git a/Aufgaben.txt b/Aufgaben.txt index 7f58d63..f93d833 100644 --- a/Aufgaben.txt +++ b/Aufgaben.txt @@ -6,6 +6,7 @@ Komponente | Priorität | wird bearbeitet von ESC (Motorsteuerung) | hoch | Yves Servo (Lenkung) | hoch | Yves Funkkommunikation | hoch | Lukas +Joystickbasiertes lenken (lib) | hoch | Lukas mechanischer Aufbau | hoch | Yves MPPT Solarlader | niedrig | nicht in Bearbeitung Bluetooth Beacon Tracking | diff --git a/Code/Joystick/Joystick.ino b/Code/Joystick/Joystick.ino new file mode 100644 index 0000000..dc68c00 --- /dev/null +++ b/Code/Joystick/Joystick.ino @@ -0,0 +1,42 @@ +#include +//Informationen Joystick +Joystick *joystick; +const uint16_t xAxisPin = 5; +const uint16_t yAxisPin = 4; +const int16_t lowestJoystickValue = 0; +const int16_t highestJoystickValue = 511; +const int16_t spaceing = 50; + +//Informationen linker Motor +Motor *left; +const int16_t lowestPWMValueLeftMotor = -255; +const int16_t highestPWMValueLeftMotor = 255; + +//Informationen rechter Motor +Motor *right; +const int16_t lowestPWMValueRightMotor = -255; +const int16_t highestPWMValueRightMotor = 255; + + +Steuerung *steuerung; + +void setup() { + joystick = new Joystick(xAxisPin, yAxisPin, lowestJoystickValue, highestJoystickValue, spaceing); + left = new Motor(lowestPWMValueLeftMotor, highestPWMValueLeftMotor); + right = new Motor(lowestPWMValueRightMotor, highestPWMValueRightMotor); + steuerung = new Steuerung(joystick, left, right); + Serial.begin(9600); +} + +void loop() { + steuerung -> updateValues(); + + //DEBUG + Serial.print("Left motor PWMValue: "); + Serial.println(left -> PWMValue); + Serial.print("Right motor PWMValue: "); + Serial.println(right -> PWMValue); + //SendValues + delay(500); + +} diff --git a/Code/libraries/Joystick/Joystick.cpp b/Code/libraries/Joystick/Joystick.cpp new file mode 100644 index 0000000..ca7be59 --- /dev/null +++ b/Code/libraries/Joystick/Joystick.cpp @@ -0,0 +1,17 @@ +#include "Joystick.h" + +Joystick::Joystick(uint16_t x_pin, uint16_t y_pin, int16_t lowestValue, int16_t highestValue, uint16_t spaceing) { + this -> x_pin = x_pin; + this -> y_pin = y_pin; + this -> lowestValue = lowestValue; + this -> highestValue = highestValue; + this -> spaceing = spaceing; +} + +void Joystick::checkJoystickInput() { + this -> xAxisReading = analogRead(x_pin); + this -> yAxisReading = analogRead(y_pin); + //9-bit reichen, der ADC schafft bestenfalls 8-bit praezision + (this -> xAxisReading) = (this -> xAxisReading) >> 1; + (this -> yAxisReading) = (this -> yAxisReading) >> 1; +} diff --git a/Code/libraries/Joystick/Joystick.h b/Code/libraries/Joystick/Joystick.h new file mode 100644 index 0000000..a1e52c6 --- /dev/null +++ b/Code/libraries/Joystick/Joystick.h @@ -0,0 +1,22 @@ +#ifndef __JOYSTICK__ +#define __JOYSTICK__ + +#include "Motor.h" + +class Joystick { + // Pin belegungen + private: + uint16_t x_pin; // Pin Nummer an dem der X-output des Joysticks angebunden ist. + uint16_t y_pin; // Pin Nummer an dem der X-output des Joysticks angebunden ist. + public: + int16_t lowestValue; + int16_t highestValue; + uint16_t spaceing; // Abstand vom mittelpunkt um zappeln zu verhindern. + int16_t xAxisReading; + int16_t yAxisReading; + + public: + Joystick(uint16_t x_pin, uint16_t y_pin, int16_t lowestValue, int16_t highestValue, uint16_t spaceing); + void checkJoystickInput(); +}; +#endif diff --git a/Code/libraries/Joystick/Motor.cpp b/Code/libraries/Joystick/Motor.cpp new file mode 100644 index 0000000..dc9acee --- /dev/null +++ b/Code/libraries/Joystick/Motor.cpp @@ -0,0 +1,7 @@ +#include "Motor.h" + +Motor::Motor(int16_t lowestValue, int16_t highestValue) { + this -> highestValue = highestValue; + this -> lowestValue = lowestValue; + this -> PWMValue = 0; +} diff --git a/Code/libraries/Joystick/Motor.h b/Code/libraries/Joystick/Motor.h new file mode 100644 index 0000000..a56c12e --- /dev/null +++ b/Code/libraries/Joystick/Motor.h @@ -0,0 +1,15 @@ +#ifndef __MOTOR__ +#define __MOTOR__ + +#include + +class Motor { + public: + int16_t highestValue; + int16_t lowestValue; + int16_t PWMValue; + + public: + Motor(int16_t lowestValue, int16_t highestValue); +}; +#endif diff --git a/Code/libraries/Joystick/Steuerung.cpp b/Code/libraries/Joystick/Steuerung.cpp new file mode 100644 index 0000000..ea015b2 --- /dev/null +++ b/Code/libraries/Joystick/Steuerung.cpp @@ -0,0 +1,67 @@ +#include "Steuerung.h" + +Steuerung::Steuerung(Joystick* joystick, Motor* left, Motor* right) { + this -> joystick = joystick; + this -> left = left; + this -> right = right; +} + +void Steuerung::mapReadingsToMatchPWMValues() { + (this -> xValue) = map(joystick -> xAxisReading, joystick -> lowestValue, joystick -> highestValue, left -> lowestValue, left -> highestValue); + (this -> yValue) = map(joystick -> yAxisReading, joystick -> lowestValue, joystick -> highestValue, right -> highestValue, right -> lowestValue); +} + +void Steuerung::applyPWMValuesDependingOnReadings() { + if ((abs(this -> xValue) > (joystick -> spaceing)) || (abs(this -> yValue) > (joystick -> spaceing))) { + if (this -> yValue >= 0) { + if (this -> xValue >= 0) { + //+y , +x + (left -> PWMValue) = this -> yValue; + (right -> PWMValue) = (this -> yValue) - (this -> xValue); + if ((this -> xValue) >= (this -> yValue)) { + (left -> PWMValue) = 255; + (right -> PWMValue) = -255; + } + } else { + //+y , -x + (left -> PWMValue) = this -> yValue; + (right -> PWMValue) = (this -> yValue) + (this -> xValue); + if (abs(this -> xValue) >= (this -> yValue)) { + (left -> PWMValue) = -255; + (right -> PWMValue) = 255; + } + } + } else { + if (this -> xValue >= 0) { + //-y , +x + (left -> PWMValue) = this -> yValue; + (right -> PWMValue) = (this -> yValue) + (this -> xValue); + if (this -> xValue >= abs(this -> yValue)) { + (left -> PWMValue) = 255; + (right -> PWMValue) = -255; + } + } else { + //-y , -x + (left -> PWMValue) = this -> yValue; + (right -> PWMValue) = (this -> yValue) - (this -> xValue); + if (abs(this -> xValue) >= abs(this -> yValue)) { + (left -> PWMValue) = -255; + (right -> PWMValue) = 255; + } + } + } + if (abs(this -> xValue) < (joystick -> spaceing)) { + (left -> PWMValue) = this -> yValue; + (right -> PWMValue) = this -> yValue; + } + } else { + (left -> PWMValue) = 0; + (right -> PWMValue) = 0; + } + +} +void Steuerung::updateValues() { + joystick -> checkJoystickInput(); + mapReadingsToMatchPWMValues(); + applyPWMValuesDependingOnReadings(); +} diff --git a/Code/libraries/Joystick/Steuerung.h b/Code/libraries/Joystick/Steuerung.h new file mode 100644 index 0000000..16553a6 --- /dev/null +++ b/Code/libraries/Joystick/Steuerung.h @@ -0,0 +1,25 @@ +#ifndef __STEUERUNG__ +#define __STEUERUNG__ + +#include "Motor.h" +#include "Joystick.h" + +class Steuerung { + private: + Joystick* joystick; + Motor* left; + Motor* right; + int16_t xValue; + int16_t yValue; + + public: + Steuerung(Joystick* joystick, Motor* left, Motor* right); + void updateValues(); + + private: + void mapReadingsToMatchPWMValues(); + void applyPWMValuesDependingOnReadings(); + + +}; +#endif diff --git a/Code/libraries/README.MD b/Code/libraries/README.MD new file mode 100644 index 0000000..55cb764 --- /dev/null +++ b/Code/libraries/README.MD @@ -0,0 +1,4 @@ +Im Ordner libraries befindet sich die Joystick librarie, +welche in den Ordner ...Arduino/libraries verschoben werden muss. +Die Joystick.ino enthält eine beispielhafte verwendung der lib, +sie kann mittels Arduino IDE Compiliert und auf den Arduino geuploaded werden. \ No newline at end of file diff --git a/Latex/.gitignore b/Latex/.gitignore new file mode 100644 index 0000000..238bc81 --- /dev/null +++ b/Latex/.gitignore @@ -0,0 +1,276 @@ +## Core latex/pdflatex auxiliary files: +*.aux +*.lof +*.log +*.lot +*.fls +*.out +*.toc +*.fmt +*.fot +*.cb +*.cb2 +.*.lb + +## Intermediate documents: +*.dvi +*.xdv +*-converted-to.* +# these rules might exclude image files for figures etc. +# *.ps +# *.eps +# *.pdf + +## Generated if empty string is given at "Please type another file name for output:" +.pdf + +## Bibliography auxiliary files (bibtex/biblatex/biber): +*.bbl +*.bcf +*.blg +*-blx.aux +*-blx.bib +*.run.xml + +## Build tool auxiliary files: +*.fdb_latexmk +*.synctex +*.synctex(busy) +*.synctex.gz +*.synctex.gz(busy) +*.pdfsync + +## Build tool directories for auxiliary files +# latexrun +latex.out/ + +## Auxiliary and intermediate files from other packages: +# algorithms +*.alg +*.loa + +# achemso +acs-*.bib + +# amsthm +*.thm + +# beamer +*.nav +*.pre +*.snm +*.vrb + +# changes +*.soc + +# comment +*.cut + +# cprotect +*.cpt + +# elsarticle (documentclass of Elsevier journals) +*.spl + +# endnotes +*.ent + +# fixme +*.lox + +# feynmf/feynmp +*.mf +*.mp +*.t[1-9] +*.t[1-9][0-9] +*.tfm + +#(r)(e)ledmac/(r)(e)ledpar +*.end +*.?end +*.[1-9] +*.[1-9][0-9] +*.[1-9][0-9][0-9] +*.[1-9]R +*.[1-9][0-9]R +*.[1-9][0-9][0-9]R +*.eledsec[1-9] +*.eledsec[1-9]R +*.eledsec[1-9][0-9] +*.eledsec[1-9][0-9]R +*.eledsec[1-9][0-9][0-9] +*.eledsec[1-9][0-9][0-9]R + +# glossaries +*.acn +*.acr +*.glg +*.glo +*.gls +*.glsdefs +*.lzo +*.lzs + +# uncomment this for glossaries-extra (will ignore makeindex's style files!) +# *.ist + +# gnuplottex +*-gnuplottex-* + +# gregoriotex +*.gaux +*.gtex + +# htlatex +*.4ct +*.4tc +*.idv +*.lg +*.trc +*.xref + +# hyperref +*.brf + +# knitr +*-concordance.tex +# TODO Comment the next line if you want to keep your tikz graphics files +*.tikz +*-tikzDictionary + +# listings +*.lol + +# luatexja-ruby +*.ltjruby + +# makeidx +*.idx +*.ilg +*.ind + +# minitoc +*.maf +*.mlf +*.mlt +*.mtc[0-9]* +*.slf[0-9]* +*.slt[0-9]* +*.stc[0-9]* + +# minted +_minted* +*.pyg + +# morewrites +*.mw + +# nomencl +*.nlg +*.nlo +*.nls + +# pax +*.pax + +# pdfpcnotes +*.pdfpc + +# sagetex +*.sagetex.sage +*.sagetex.py +*.sagetex.scmd + +# scrwfile +*.wrt + +# sympy +*.sout +*.sympy +sympy-plots-for-*.tex/ + +# pdfcomment +*.upa +*.upb + +# pythontex +*.pytxcode +pythontex-files-*/ + +# tcolorbox +*.listing + +# thmtools +*.loe + +# TikZ & PGF +*.dpth +*.md5 +*.auxlock + +# todonotes +*.tdo + +# vhistory +*.hst +*.ver + +# easy-todo +*.lod + +# xcolor +*.xcp + +# xmpincl +*.xmpi + +# xindy +*.xdy + +# xypic precompiled matrices and outlines +*.xyc +*.xyd + +# endfloat +*.ttt +*.fff + +# Latexian +TSWLatexianTemp* + +## Editors: +# WinEdt +*.bak +*.sav + +# Texpad +.texpadtmp + +# LyX +*.lyx~ + +# Kile +*.backup + +# gummi +.*.swp + +# KBibTeX +*~[0-9]* + +# TeXnicCenter +*.tps + +# auto folder when using emacs and auctex +./auto/* +*.el + +# expex forward references with \gathertags +*-tags.tex + +# standalone packages +*.sta + +# Makeindex log files +*.lpz \ No newline at end of file diff --git a/Latex/images/fish.png b/Latex/images/fish.png new file mode 100644 index 0000000..d239094 Binary files /dev/null and b/Latex/images/fish.png differ diff --git a/Latex/main.pdf b/Latex/main.pdf new file mode 100644 index 0000000..3f4c445 Binary files /dev/null and b/Latex/main.pdf differ diff --git a/Latex/main.tex b/Latex/main.tex new file mode 100644 index 0000000..1b5caa3 --- /dev/null +++ b/Latex/main.tex @@ -0,0 +1,139 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Lachaise Assignment +% LaTeX Template +% Version 1.0 (26/6/2018) +% +% This template originates from: +% http://www.LaTeXTemplates.com +% +% Authors: +% Marion Lachaise & François Févotte +% Vel (vel@LaTeXTemplates.com) +% +% License: +% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/) +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%---------------------------------------------------------------------------------------- +% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS +%---------------------------------------------------------------------------------------- + +\documentclass{article} + +\input{structure.tex} % Include the file specifying the document structure and custom commands + +%---------------------------------------------------------------------------------------- +% INFORMATION +%---------------------------------------------------------------------------------------- + +\title{Open Source Roboter Plattform} % Title + +\author{Lukas Reichwein\\ Yves Ehrlich\\ Nick Gnoevoj} + +\date{University of Applied Science Fulda --- \today} % University, school and/or department name(s) and a date + +%---------------------------------------------------------------------------------------- + +\begin{document} + +\maketitle % Print the title +\tableofcontents % Inhaltsverzeichniss, Achtung zweimal Compilerien! +\newpage + +%---------------------------------------------------------------------------------------- +% INTRODUCTION +%---------------------------------------------------------------------------------------- + +\section*{Vorwort} % Unnumbered section + + Motivation, Basis, Ziel des Projektes. + +\newpage +%---------------------------------------------------------------------------------------- +% Latex Beispeiele +%---------------------------------------------------------------------------------------- +\section{Beispiele für Spezielle LaTeX Strukturen} + +\begin{info} % Information block + benutze den Info block um wichtige informationen hervorzuheben. +\end{info} + +%---------------------------------------------------------------------------------------- +% Beispiel für Pseudo Code. +%---------------------------------------------------------------------------------------- + +\begin{center} + \begin{minipage}{0.5\linewidth} % Adjust the minipage width to accomodate for the length of algorithm lines + \begin{algorithm}[H] + \KwIn{$(a, b)$, two floating-point numbers} % Algorithm inputs + \KwResult{$(c, d)$, such that $a+b = c + d$} % Algorithm outputs/results + \medskip + \If{$\vert b\vert > \vert a\vert$}{ + exchange $a$ and $b$ \; + } + $c \leftarrow a + b$ \; + $z \leftarrow c - a$ \; + $d \leftarrow b - z$ \; + {\bf return} $(c,d)$ \; + \caption{\texttt{FastTwoSum}} % Algorithm name + \label{alg:fastTwoSum} % optional label to refer to + \end{algorithm} + \end{minipage} +\end{center} + +%---------------------------------------------------------------------------------------- +% Beispiel für Code Snippets. +%---------------------------------------------------------------------------------------- + +% File contents +\begin{file}[hello.py] +\begin{lstlisting}[language=Python] +#! /usr/bin/python + +import sys +sys.stdout.write("Hello World!\n") +\end{lstlisting} +\end{file} + +%---------------------------------------------------------------------------------------- +% Example for Console Prints (can also be usefull for displaying Serial monitor) +%---------------------------------------------------------------------------------------- + + +% Command-line "screenshot" +\begin{commandline} + \begin{verbatim} + $ chmod +x hello.py + $ ./hello.py + + Hello World!S + \end{verbatim} +\end{commandline} + + +% Warning text, with a custom title +\begin{warn}[Notice:] + Warungen könnten auch nützlich sein, immerhin braucht der RF24 3.3V und nicht 5V +\end{warn} + +%---------------------------------------------------------------------------------------- +% Beispiel für ein Bild. +%---------------------------------------------------------------------------------------- + +\begin{figure}[h] + \includegraphics[width=8cm]{fish.png} + \centering +\end{figure} + +%---------------------------------------------------------------------------------------- +% BIBLIOGRAPHY +%---------------------------------------------------------------------------------------- + +\bibliographystyle{unsrt} + +\bibliography{sample.bib} + +%---------------------------------------------------------------------------------------- + +\end{document} diff --git a/Latex/references.bib b/Latex/references.bib new file mode 100644 index 0000000..1443ef4 --- /dev/null +++ b/Latex/references.bib @@ -0,0 +1,19 @@ +@BOOK{Smith:2012qr, + title = {{B}ook {T}itle}, + publisher = {Publisher}, + author = {Smith, J.~M. and Jones, A.~B.}, + year = {2012}, + edition = {7th}, +} + +@ARTICLE{Smith:2013jd, + author = {Jones, A.~B. and Smith, J.~M.}, + title = {{A}rticle {T}itle}, + journal = {Journal title}, + year = {2013}, + volume = {13}, + pages = {123-456}, + number = {52}, + month = {March}, + publisher = {Publisher} +} \ No newline at end of file diff --git a/Latex/structure.tex b/Latex/structure.tex new file mode 100644 index 0000000..0c84f3a --- /dev/null +++ b/Latex/structure.tex @@ -0,0 +1,233 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Lachaise Assignment +% Structure Specification File +% Version 1.0 (26/6/2018) +% +% This template originates from: +% http://www.LaTeXTemplates.com +% +% Authors: +% Marion Lachaise & François Févotte +% Vel (vel@LaTeXTemplates.com) +% +% License: +% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/) +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%---------------------------------------------------------------------------------------- +% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS +%---------------------------------------------------------------------------------------- + +\usepackage[ngerman]{babel} %UMLAUTE + +\usepackage{amsmath,amsfonts,stmaryrd,amssymb} % Math packages + +\usepackage{enumerate} % Custom item numbers for enumerations + +\usepackage[ruled]{algorithm2e} % Algorithms + +\usepackage[framemethod=tikz]{mdframed} % Allows defining custom boxed/framed environments + +\usepackage{listings} % File listings, with syntax highlighting +\lstset{ + basicstyle=\ttfamily, % Typeset listings in monospace font +} + +\usepackage{graphicx} +%Path relative to the main .tex file +\graphicspath{ {images/} } + +%---------------------------------------------------------------------------------------- +% DOCUMENT MARGINS +%---------------------------------------------------------------------------------------- + +\usepackage{geometry} % Required for adjusting page dimensions and margins + +\geometry{ + paper=a4paper, % Paper size, change to letterpaper for US letter size + top=2.5cm, % Top margin + bottom=3cm, % Bottom margin + left=2.5cm, % Left margin + right=2.5cm, % Right margin + headheight=14pt, % Header height + footskip=1.5cm, % Space from the bottom margin to the baseline of the footer + headsep=1.2cm, % Space from the top margin to the baseline of the header + %showframe, % Uncomment to show how the type block is set on the page +} + +%---------------------------------------------------------------------------------------- +% FONTS +%---------------------------------------------------------------------------------------- + +\usepackage[utf8]{inputenc} % Required for inputting international characters +\usepackage[T1]{fontenc} % Output font encoding for international characters + +\usepackage{XCharter} % Use the XCharter fonts + +%---------------------------------------------------------------------------------------- +% COMMAND LINE ENVIRONMENT +%---------------------------------------------------------------------------------------- + +% Usage: +% \begin{commandline} +% \begin{verbatim} +% $ ls +% +% Applications Desktop ... +% \end{verbatim} +% \end{commandline} + +\mdfdefinestyle{commandline}{ + leftmargin=10pt, + rightmargin=10pt, + innerleftmargin=15pt, + middlelinecolor=black!50!white, + middlelinewidth=2pt, + frametitlerule=false, + backgroundcolor=black!5!white, + frametitle={Command Line}, + frametitlefont={\normalfont\sffamily\color{white}\hspace{-1em}}, + frametitlebackgroundcolor=black!50!white, + nobreak, +} + +% Define a custom environment for command-line snapshots +\newenvironment{commandline}{ + \medskip + \begin{mdframed}[style=commandline] +}{ + \end{mdframed} + \medskip +} + +%---------------------------------------------------------------------------------------- +% FILE CONTENTS ENVIRONMENT +%---------------------------------------------------------------------------------------- + +% Usage: +% \begin{file}[optional filename, defaults to "File"] +% File contents, for example, with a listings environment +% \end{file} + +\mdfdefinestyle{file}{ + innertopmargin=1.6\baselineskip, + innerbottommargin=0.8\baselineskip, + topline=false, bottomline=false, + leftline=false, rightline=false, + leftmargin=2cm, + rightmargin=2cm, + singleextra={% + \draw[fill=black!10!white](P)++(0,-1.2em)rectangle(P-|O); + \node[anchor=north west] + at(P-|O){\ttfamily\mdfilename}; + % + \def\l{3em} + \draw(O-|P)++(-\l,0)--++(\l,\l)--(P)--(P-|O)--(O)--cycle; + \draw(O-|P)++(-\l,0)--++(0,\l)--++(\l,0); + }, + nobreak, +} + +% Define a custom environment for file contents +\newenvironment{file}[1][File]{ % Set the default filename to "File" + \medskip + \newcommand{\mdfilename}{#1} + \begin{mdframed}[style=file] +}{ + \end{mdframed} + \medskip +} + +%---------------------------------------------------------------------------------------- +% NUMBERED QUESTIONS ENVIRONMENT +%---------------------------------------------------------------------------------------- + +% Usage: +% \begin{question}[optional title] +% Question contents +% \end{question} + +\mdfdefinestyle{question}{ + innertopmargin=1.2\baselineskip, + innerbottommargin=0.8\baselineskip, + roundcorner=5pt, + nobreak, + singleextra={% + \draw(P-|O)node[xshift=1em,anchor=west,fill=white,draw,rounded corners=5pt]{% + Question \theQuestion\questionTitle}; + }, +} + +\newcounter{Question} % Stores the current question number that gets iterated with each new question + +% Define a custom environment for numbered questions +\newenvironment{question}[1][\unskip]{ + \bigskip + \stepcounter{Question} + \newcommand{\questionTitle}{~#1} + \begin{mdframed}[style=question] +}{ + \end{mdframed} + \medskip +} + +%---------------------------------------------------------------------------------------- +% WARNING TEXT ENVIRONMENT +%---------------------------------------------------------------------------------------- + +% Usage: +% \begin{warn}[optional title, defaults to "Warning:"] +% Contents +% \end{warn} + +\mdfdefinestyle{warning}{ + topline=false, bottomline=false, + leftline=false, rightline=false, + nobreak, + singleextra={% + \draw(P-|O)++(-0.5em,0)node(tmp1){}; + \draw(P-|O)++(0.5em,0)node(tmp2){}; + \fill[black,rotate around={45:(P-|O)}](tmp1)rectangle(tmp2); + \node at(P-|O){\color{white}\scriptsize\bf !}; + \draw[very thick](P-|O)++(0,-1em)--(O);%--(O-|P); + } +} + +% Define a custom environment for warning text +\newenvironment{warn}[1][Warning:]{ % Set the default warning to "Warning:" + \medskip + \begin{mdframed}[style=warning] + \noindent{\textbf{#1}} +}{ + \end{mdframed} +} + +%---------------------------------------------------------------------------------------- +% INFORMATION ENVIRONMENT +%---------------------------------------------------------------------------------------- + +% Usage: +% \begin{info}[optional title, defaults to "Info:"] +% contents +% \end{info} + +\mdfdefinestyle{info}{% + topline=false, bottomline=false, + leftline=false, rightline=false, + nobreak, + singleextra={% + \fill[black](P-|O)circle[radius=0.4em]; + \node at(P-|O){\color{white}\scriptsize\bf i}; + \draw[very thick](P-|O)++(0,-0.8em)--(O);%--(O-|P); + } +} + +% Define a custom environment for information +\newenvironment{info}[1][Info:]{ % Set the default title to "Info:" + \medskip + \begin{mdframed}[style=info] + \noindent{\textbf{#1}} +}{ + \end{mdframed} +}