Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Cleanup Robot (Help) Program
Old
CoolGuy2014
Junior Member
 
Status: Offline
Posts: 1
Join Date: Feb 2014
Default Cleanup Robot (Help) Program - 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!
Attached Files
File Type: a2w Rebot.a2w (1.10 MB, 10 views)
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 210
Join Date: Dec 2012
Location: Frosno, Ca
Default 02-28-2014, 09:46 AM

Quote:
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:
Code:
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
mhenwood@ieee.org
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.