View Single Post
Super Moderator
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 02-28-2014, 09:46 AM

Originally Posted by CoolGuy2014 View Post
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.
  1. Create the initial "gorillaRobot move forward 1" instruction.
  2. Click on the function tab for the gorillaRobot's details
  3. drag "gorillaRobot distance to " to where the 1 is in the above statement.
  4. Alice will ask for an object (distance to what). If you go to the bottom of the list (expressions) you can select "thing."
  5. Click the white down arrow at the end of the distance to statement, select math and "gorillaRobot distance to thing - "
  6. Stick in an number to complete the expression.
  7. Finally, drag in "gorillaRobot's width" and replace the dummy value you used with it.

Mark Henwood
Reply With Quote