Algorithm For Medical Nanobots Using C++
Algorithm For Medical Nanobots Using C++
Algorithm For Medical Nanobots Using C++
Manu Mitra Electrical Engineering Department, University of Bridgeport, Bridgeport, CT, USA
In this code Watchdog time class has been used to make sure
that the nanobot will stop operating if program does something
unexpected or crashes. something unexpected or crashes
1. #include “Libraryfile.h” // Library File for
Nanobot
2. #include “Nanobot.h” // Includes all functions,
recursion loops for Nanobot
3. static const UINT32 LEFT_Nanobot_
PORT = 1; // Left Navigation for Nanobot
4. static const UINT32 RIGHT_Nanobot_
PORT = 2; // Right Navigation for Nanobot
5. static const UINT32 JOYSTICK_
PORT = 1; // Manual movement if automation is
failed
6. void Initialize(void) {
7. CreateRobotDrive(LEFT_Nanobot_PORT, RIGHT_
Nanobot_PORT);
Figure 1: Depicts nanobot repairing a damaged DNA
8. SetWatchdogExpiration(0.1); // Watchdog
(Deoxyribonucleic Acid) timer
9. }
huge increase in regenerative medicine. Nanobots help to enhance its 10. void Autonomous(void) {
impact on medicine in the near future by providing an effective way 11. SetWatchdogEnabled(false);
of delivering them [5](Figure 1) [6].
12. Drive(0.5, 0.0);
Flow Diagram of Medical Nanobot 13. Wait(2.0);
14. Drive(0.0, 0.0);
A. Creating nanobot base class
15. }
Pseudocode for simple nanobot base class Example I
16. void OperatorControl(void) {
Below is the example code to create a nanobot’s base class [7].
17. SetWatchdogEnabled(true);
1. class SimpleNanobot: public NanobotBase {
18. while (IsOperatorControl()) {
2. public: SimpleRobot(void);virtual void Autonomo
us(); void OperatorControl();virtual void na 19. WatchdogFeed();
nobotMain();virtual void StartCompetition() 20. ArcadeDrive(JOYSTICK_PORT);
;private: bool m_nanobotMainOverridden; 21. }
3. }; 22. }
Pseudocode for Start Competition method Example II 23. START_ROBOT_CLASS(Nanobot);
1. void
Simple pseudocode for nanobot Pan/Tilt in C++
SimpleNanobot::StartCompetition
(void) { Below is the example code for Pan/Tilt in C++ [8].
1. #include < Libraryfile.h > // This loads the
while (IsDisabled()) Wait(0.01); // waiti Nanobot script, allowing you to use specific
ng for match to start functions below
2. if (IsAutonomous()) // making nanobot auto 2. #include < Nanobot.h > // Includes all func
nomous tions, recursion loops for Nanobot
3. { 3. Nanobot myNanobot; // create Nanobot object to
4. Autonomous(); // to run user provided control a Nanobot
Autonomous code 4. int pos = 0; // variable to store the Nanobot
5. } position
6. while (IsAutonomous()) Wait(0.01); // nano 5. void setup() // required in all Nanobot Software
bot wait until end of autonomous code
7. while (IsDisabled()) Wait(0.01); // make 6. {
sure that nanobot is enabled 7. myNanobot.attach(9); // attaches the Nanobot on
8. OperatorControl(); // start user provided pin 9 to the Nanobot object
OperatorControl 8. }
9. } 9. void loop() // required in all Nanobot Software
B. Manual and Autonomous Pseudocodes for code
Nanobots 10. {
An attempt is made for basic manual execution of program 11. for (pos = 0; pos < 180; pos += 1)
for a Medical Nanobot using C/C++ language. //
variable ‘pos’ goes from 0 degrees to 180 degr
Basic program of nanobot using C
ees in steps of 1 degree
Below is the pseudocode in C program that demonstrates driving
12. {
the Nanobot for 2 seconds forward in Autonomous and in arcade
mode for the Operator Control. 13. myNanobot.write(pos); // tell Nanobot to go to
Pseudocode for Declaration Class Example III Pseudocode for nano solenoid
1. RobotDrive * Nanobot Range greenHue, 1. Nano_Solenoid * s[8];
greenSat, greenLum; // Declaration 2. for (int i = 0; i < 8; i++) s[i] = new Solenoid
Class for nanobot (i + 1);
Pseudocode for Initialization of nano camera Example // allocate the Nano Solenoid objects
IV 3. for (int i = 0; i < 8; i++) {
1. if (StartCameraTask() == -1) {
4. s[i] - > Set(true); // turn them all on
2. printf(“Failed to spawn camera
5. }
task; Error code %s”, GetErrorText(GetLast
Error())); 6. for (int i = 0; i < 8; i++) {
3. } 7. s[i] - > Set(false); // turn them each off
in turn
4. nanobot = new RobotDrive(1, 2); // values
for tracking a target -may need tweaking 8. Wait(1.0);
in the environment greenHue.minValue = 65; 9. }
greenHue.maxValue = 80; greenSat.minValue 10. for (int i = 0; i < 8; i++) {
= 100; greenSat.maxValue = 255; greenLum
11. s[i] - > Set(true); // turn them back on
.minValue = 100; greenLum.maxValue = 255;
in turn
Pseudocode for Automating for nanobot Example IV 12. Wait(1.0);
1. while (IsAutonomous()) {
13. delete s[i]; // delete the objects
2. if (FindColor(IMAQ_HSL, & greenHue,
14. }
& greenSat, & greenLum, & par) && par.particl
eToImagePercent < MAX_PARTICLE_TO_IMAGE_PERCE G. Synchronization of Nanobots
NT && par.particleToImagePercent > MIN_PARTI When there are multiple nanobots then synchronization is
CLE_TO_IMAGE_PERCENT) { required. So that multiple nanobots can perform accordingly to
complete the task accordingly.
3. nanobot - > Drive(1.0, (float) par.cen
ter_mass_x_normalized); Pseudocode for synchronization example I
4. } else nanobot - > Drive(0.0, 0.0); 1. {
5. Wait(0.05); 2. Synchronized s(semaphore); // access shared
code here
6. }
3. if (condition) return; // more code
7. nanobot - > Drive(0.0, 0.0); // Automating here
nanobot
4. } // Synchronization for nanobot
F. Nano Servo Mechanismfor Nanobots
Pseudocode for critical condition example II
Nano Servomechanism is also required for nanobots for 1. {
rotation. 2. Synchronized s(semaphore); // access shared
code here
Pseudocode for Nano servo mechanism Example-I
1. Servo servo(3); // create a servo on PWM port 3. if (condition) return; // more code
3 on the first module here
Figure 4: .Flow Chart of a Medical Nanobot for performing various operations inside the body
References 9. Seiko E. Gyro sensors - How they work and what’s ahead. 2018
1. Solomon N. System and methods for collective nanorobotics for 10. Umple Online: Generate Java, C++, PHP, Alloy, NuSMV or Ruby
medical applications. 2008 code from Umple. University of Ottawa; 2018.
2. Mitra M. Medical Nanobot for Cell and Tissue Repair. Int Rob Auto 11. Overview of Robotic Vision - Object Tracking and Image
J. 2017; 2(6): 38. Processing Software. Into robotics; 2013.
3. Microscopemaster. Nanobots - Uses in Medicine and Industry - 12. Solenoid - Let’s Make Robots! - RobotShop. Robot Shop.2008.
Engineering and Drawbacks; 2018.
13. Jacob T, Hemavathy K, Jacob J, Hingorani A, Marks N, et al. A
4. Jonathan S. How Nanorobots Will Work. Stuff Works; 2007. nanotechnology-based delivery system: Nanobots. Novel vehicles
5. Bhat AS. Nanobots: The future of medicine. JEMS.2014;5(1):44- for molecular medicine. J Cardiovasc Surg. 2011;52(2): 159-167.
49. 14. Haberzettl CA. Nanomedicine: destination or
6. Moorthy K. Nanobots can check and repair dna. 2016. journey?. Nanotechnology. 2002; 13(4): R9-R13.
7. Miller B, Streeter K, Finn B, Morrison J. C/C++ Programming 15. Loscrí V, Natalizio E, Mannara V, Aloi G. A Novel Communication
Guide for the FIRST Robotics Competition. 2008 Technique for Nanobots Based on Acoustic Signals. Lecture Notes
8. Benson C. How to Make a Robot - Lesson 10: Programming Your of the Institute for Computer Sciences, Social Informatics and
Robot. Robot Shop Blog. 2012. Telecommunications Engineering. 2014; 91-104.