PDA

View Full Version : Cleanup Robot (Help) Program


CoolGuy2014
02-27-2014, 03:09 PM
Hello I am working on the cleanup robot program and the robot is supposed to pick up 3 objects and move them to the closet. However the robot moves but it doesn't pick them up and put them in the closest. I've been trying to figure out what I did wrong and can't seem to find the problem so I was hoping someone could lead me in the right direction!

The file is attached. I would really appreciate any help!

chickentree
02-28-2014, 09:46 AM
Hello I am working on the cleanup robot program and the robot is supposed to pick up 3 objects and move them to the closet. However the robot moves but it doesn't pick them up and put them in the closest. I've been trying to figure out what I did wrong and can't seem to find the problem so I was hoping someone could lead me in the right direction!

The file is attached. I would really appreciate any help!

The first thing I would suggest is look at both your fetch method and your movie. What is the actually happening in the movie?

***********************************************

You are setting the vehicle of the robots hand to the barbell. This means that wherever the barbell goes the hand will follow it. If you look at the barbell after the robot moves toward the closet door, you will see the robot's hand stuck to it. I would assume you want to do the opposite and set the barbell's vehicle to the robots hand.

Other problems:
1) You are not accounting for the fact that the distance to an object is the distance to the center of that object, so you want to stop a little short of the object (Examples in the book suggest something like distance to thing - robot.width/2)
2) You are moving a fixed amount. In general, with this kind of a programming environment, you do not want to use fixed, or hard coded, values like 1. Instead use a function to find out how far the robot is from its target. So your code would look something:

gorillaRobot turn to face thing
gorillaRobot move forward (gorillaRobot distance to thing - subject = gorillaRobot's width)

Remember that with Alice constructing the move forward is a multistep process.
Create the initial "gorillaRobot move forward 1" instruction.
Click on the function tab for the gorillaRobot's details
drag "gorillaRobot distance to " to where the 1 is in the above statement.
Alice will ask for an object (distance to what). If you go to the bottom of the list (expressions) you can select "thing."
Click the white down arrow at the end of the distance to statement, select math and "gorillaRobot distance to thing - "
Stick in an number to complete the expression.
Finally, drag in "gorillaRobot's width" and replace the dummy value you used with it.