This unit as a whole has been focusing on the sensors and feedback control, with this task we would have a better grasp of the task at hand. Though this doesn’t change/affect the robot in any way (the way it moves) it does give us an understanding of how parts work. In this unit particular, I had to change the motors quite a bit because I had different robots almost every class.
I also found that online resources were extremely helpful such as ‘robotc main page’ which I used exclusively. Here I was able to find the resources needed to program my computer, in addition, it helps me understand parts of robots, such as the pedometer that counts the distance.
The main goal of this task was to apply what we had learned to get a robot dance. Well, we had to formulate code in order to get the robot moving, but instead of looking at the code like our other projects this was solely focused on the outcome. So for this project I had a pool of choice, however, I narrowed it down to two,‘Feel it Still’ by Portugal the. Man and ‘Roses’ by Chainsmokers. I could have chosen any one of these songs and I feel like I would have been really happy with my decision, however, in the end, I choose ‘Feel it Still” because it had a rhythm that was unlike the other songs I have heard. It had a quick beat and quick key changes. Knowing what song you wanted to do was crucial to the process – I had friends that kept changing their songs back and forth, finally ending up at their original song. Now that I knew what my song I wanted to do, I knew that my dance would have to be quick and sporadic, which meant it would be important to get the time right.
Like I mentioned above, unlike the other project we have done where the code was the most important – the outcome of the dance is what was the most important. Parent and students alike wouldn’t need to need to see the code. The code you see below was not my first draft, in the way that I changed the program for my robot more than four times. What I think was the challenge was the transition, it was really tough for me to be able to go from a sporadic tune to a very chorus and soothing tune, I tried a couple of times trying to slow down the robot as it got slower, but it looked very awkward. However the one thing I kept throughout all my drafts was the very first part of the dance where the robot went back and forth – it not only followed the beat, but it also made for a good beat. During this part, I really tried to connect the sound of starting and stopping the motors to be in sync with that of the metronome. At the time I thought I did a really good job, I found the transition time, however, there was a major issue which I will talk about later in my next paragraph. The next things I tried to do was make the arm move back and forth – the only reason why I do so was that in the music video the hand movement caught my attention. After the robot arm went back and forth it would it, it would do a small multitask function here the arm would move while the robot did wheelies. However, I ran into the same problem that I did early which I explain in the next paragraph. The next function was moving the robot in circles stationary. This was a throwback from the very first class, where if you make one motor negative and the other one positive it robot should be spin stationary. This was the just of my dance, I pretty much got this far. But the reason why there are so many lines of coeds is that after I completed what I mentioned above I copy and pasted the exact code and changed some values to match the tunes of the robot. We had quite a few classes to work and I made around a function per class, which honestly aren’t good returns, but a couple of these functions were brand new to me, which I will explain in the paragraph solely dedicated to what I learned throughout this experience.
There were two major problems that were really slowing me down, the matching the start and stop colons and virtual worlds back to the physical robot. The first problem that really slowed me down was matching the start and stop functions mainly because I tried a lot of new things that didn’t plan out like I wanted it to, so I would have to scrap it completely which got me into a hole where I kept deleting and creating new stop of start codons. The second and biggest problem was the transition from virtual robots and physical robots. The problem is that in virtual world it doesn’t account for the power change, meaning that no matter what power the robot is on it looks normal. So when I changed from virtual to physical where the robot looked completely normal and ran extremely smoothly the physical robot flipped multiple times. I wasn’t sure what the problem was until Ms. Mok had explained it to me, and the reason why I hadn’t thought of it was that I never encountered an issue like this. So when I did I wasn’t sure what to do. It was very troublesome to change the robot’s powers completely have to test it by downloading it to the robot so many times. In the end, everything was completely changed, before it worked really well con virtual worlds where the dance went as I wanted it to go, however, as I changed the power level of the robot in virtual worlds performance kept going down. While the performance of the physical robot kept changing mainly due to the robot being used. The issue was the only 3/7 robot were working so I would change the power level of my program depending on the robot, this made it very hard because I kept switching robot which means that I would that the power level would affect the performance depending on the robot being used.
Though I had the issue that greatly changed the outcome of my project, I learned a few things in the coding department and the general use of robotics department. I found out new ways to make asks, such as ‘for’ which proved to be very useful. I really like using ‘for’ because it was a really nice way to keep the function at bay. The next issue I had was the multi-task functions, on the physical robot, the arm and the robot was completely out of sync and/ the motor on the arm was so powerful that robot kept making a crackling sound. I think for future use to make another document of the robot working in virtual worlds and then make another document for the physical robot. In addition, I spent a whole class trying to reorganize my code because the code it self-looked like it was too much. So instead of spending whole class organizing things, I should just start off by making my code concise.
Overall, the main takeaways from this project are to always check on the physical robot throughout the project, I spend so much time and effort on virtual worlds which all went to waste because of the power level. And next time I shouldn’t spend all my time and effort in virtual worlds when the final product and most important part of the summative is on the physical robot.
Link (Virtual worlds): https://www.youtube.com/watch?v=3bnz0JF6uxE
So Ms. Mok helped me a lot to re-organize my code, originally my code didn’t play out the way I wanted it, instead, it froze after the first line of code. The way she showed me was a similar way of organizing my code when I took intro to programming. I also was able to add multitasking to my code. After Ms. Mok showed it to me it was quite easy to add it. I went to Ms. Mok’s office where she reminded me how to use it, so I quickly added it in. It also lasts for two minutes now too!!!
How to do Multitasking (6 Steps to use multitasking)
- Make sure that you open a multitasking sample, the sample program is a very easy way to organize your code for multitasking.
- Copy and paste the pragma statements that are needed to be able to run the motors. Also, make sure the motors are connected, make sure they are in the right place.
- You will be met with task one, task two, and task main. Task one and task two is basically where you do to do multitasking. While task main is the main program, meaning what the robot runs.
- Once you have it task one and task two code you can writeStartTask(One)StartTask(Two)
- You can test either one virtual robot or physical robot, the power for each vary so I recommend you test virtual worlds first to see if it does what you want it to do, then test of the physical robot and modify the power.
- Troubleshooting: You can go on RobotC and search up multitasking tutorial, or you can look at the open sample and write very basic code to see what your errors are.
Link to virtual worlds: https://youtu.be/Dc0ZL5Dp4bg