Archive for Interface

Adding a Camera

Now that the necessary buttons, sliders, and spinner boxes have been added to the interface, it is time to find a way to attach a camera to the robot. The camera will allow a user to control the robot without having to be in the same room as the robot (albeit within 30 feet of the robot). However, there is no default video component in C#. As such, some exploration needs to be done to see if such a component exists. If a video component is available, a wireless camera must be found that will work with it.

Comments

Gripper Buttons

The next buttons to add to the interface were those to control the opening and closing of the grippers. To do so, I once again used the turn command provided by Fokke. However, in using this command, I got unexpected results. I had programmed the motor controlling the grippers to open and close 90 degrees. To my surprise, this caused the grippers to open too wide. To resolve this issue, I used trial and error. As it turns out, the degrees the motor controlling the gripper must turn works best at 60 degrees. With the addition of the open and close gripper buttons, the interface now provides the user with all the options they need to use the robot to grab a ball off a stand and then place the ball back on the stand. In addition, the interface can be used to perform other tasks with the robot as well.

Comments (1)

Controlling Speed with a Slider

Now that the interface includes a precise way to turn the robot, it was time to devise a way for the user to precisely control the speed of the robot. After some thought, I came to the conclusion that a slider would be ideal. Again, having no prior background in C#, I had to investigate how to first add a slider to my interface and then correctly code it. Similar to the spinner box, the slider also needed a minimum and maximum value. Learning my lesson from the spinner box, I checked the properties box of the slider before proceeding to the code. As it turns out, I was able to set the minimum and maximum value from the properties panel. The next issue with the slider was determining the jump interval. Initially, I had the slider jump by values of 10. However, when I tried to use the slider to control the speed, I felt I was very limited in my choices. As such, I changed the increment property of the slider to 1. This gives the user very fined tuned control over the speed of the motor. Even though there were a few bumps in the road, and some problems to overcome, I feel my progression in creating the interface is going very well.

 

Comments

Turning and the Spinner Box

In looking at the interface, I was a little uncomfortable having the user type the amount of degrees they wished the robot to turn into a textbox. I decided that a spinner box, with a minimum value of 0 and a maximum value of 360, would be better. This meant it was time to learn how to use a spinner box. In my first attempt, I wrote the minimum and maximum values using code. However, I soon realized that you could apply a minimum and maximum value from the properties panel of the spinner box. When I figured this out, I erased the code I had written and used the properties panel to apply a minimum and maximum value. I also changed the interval amount to 1, so that when the user clicked on the up or down arrow in the spinner box, the displayed value would increase and decrease by 1 respectively. Next, I created a global variable to store the text string shown in the spinner box. I then wrote the code to convert the text string stored in the variable into a numeric number. The global variable was then placed in the command used to turn the robot. This procedure was added to both the left and right turn buttons.

Comments

The Turning Constant

In meeting with Chandima, he saw that a discrete pattern existed in the amount of degrees the robot must turn to coincide with the amount of degrees the user typed into the textbox. As such, he provided me with a method to determine the decimal number the degrees the user types in should be multiplied by. In figuring out this constant, I was able to completely eliminate the if/then statement I had written. Overall, this little suggestion made the code much cleaner, easier to follow, and more efficient.

Comments

Turning and Textboxes

Having the user select the amount of degrees to turn proved to be quite a challenging process. To control the degrees the robot turns, I thought it would be best to use a textbox in which the user typed in the degrees. In Fokke’s tutorial, he provided a command to turn the robot. However, when you type in the amount of degrees, for example 90 degrees, the robot does not turn that amount. Instead, the motor turns 90 degrees but the robot does not due to slipping. To overcome this issue, I had to determine the amount of degrees a motor must spin in order to turn the robot the correct amount of degrees. After much trial and error, I found that the amount of degrees the user types into the textbox has to be multiplied by about four. In addition, for each 90 degree interval, the amount of degrees the user types in the textbox has to not only be multiplied by four, but an additional amount of degrees has to be added to the number. Because of this, I had to create an if/then statement for each 90 degree interval, up to 360 degrees. During the process of figuring out how to get the robot to turn, I learned how to write an if/then statement, declare a global variable, and convert a string in to a number in C#.

Comments

Starting to Design the Interface

Having learned how to use the motor commands provided in Fokke’s tutorial, it is time to start learning different aspects of C# and create an interface for running the robot.  To begin, I have placed four buttons on the interface that I plan to use to move the robot forward, backwards, left, and right.  In addition, I have included a brake button to stop the robot.  Working with the forwards and back commands, I have realized that the robot tends to move in a curved direction even though both motors are running at the same speed.  To overcome this issue, I have slowed the motor speed to about 50%.  Although not totally perfect, this seems to have greatly mitigated the problem.  My first attempt at turning the robot called for using the turn command and setting the motor speed to 50%.  In doing so, the user would have to hit a brake button to stop the robot after it turned the desired amount.  However, when trying this method out, I found it extremely difficult to precisely control the amount the robot turned.  Currently, I am trying to develop a way for the user to control the amount of degrees the robot must turn.  In order to accomplish this I will need to learn more about how to write a C# program.

Comments