Send to closest unoccupied space

  • Thread starter Thread starter axe34
  • Start date Start date
  • Tags Tags
    Space
Click For Summary

Discussion Overview

The discussion revolves around a mechanical project involving the automation of sending and retrieving objects to and from an array of shelf spaces. Participants explore the design and programming aspects of the system, including the use of actuators, sensors, and algorithms for managing the shelf space.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes the project goal of sending objects to the nearest available shelf space using a 'send' button and retrieving them with a potentiometer.
  • Another participant questions the relevance of the actuators and suggests that the project resembles a school assignment, prompting a defensive response from the original poster.
  • The original poster clarifies that the actuators are a combination of DC motors and stepper motors, and that micro switches will be used as sensors.
  • A participant suggests implementing a linear search algorithm for managing the shelf spaces, proposing the use of a bit-array to track the occupancy of each bin.
  • The same participant provides a code snippet for finding the first empty bin in a 16-bit array, emphasizing the importance of understanding the microcontroller's capabilities.

Areas of Agreement / Disagreement

Participants express differing views on the nature of the project, with some perceiving it as a simple school project while others assert its complexity. There is no consensus on the relevance of the mechanical components to the programming discussion.

Contextual Notes

There are unresolved questions regarding the mechanical design and the specific implementation details of the project, including the number of I/O connections required for a real system.

axe34
Messages
38
Reaction score
0
Hi

I'm undertaking a mechanical project whereby I wish to send an object (crate etc.) to an array of shelf spaces. Each space will have a button, so that when the object is put into the space, the button will be pressed by the weight of the object.

So, I want to start from having all shelves free, press a 'send' button and the object will be taken to the closest space, the next object to the 2nd closest space etc. I then want to retrieve an object from any space too. The idea is that I want to have one 'send' button (sends to nearest space) and I will use a potentiometer and button to retrieve from the desired space I select.

Does anyone have an idea where to begin? Has anyone done anything similar? I'm using CCS compiler and C code.Thanks
 
Technology news on Phys.org
axe34 said:
Hi

I'm undertaking a mechanical project whereby I wish to send an object (crate etc.) to an array of shelf spaces. Each space will have a button, so that when the object is put into the space, the button will be pressed by the weight of the object.

So, I want to start from having all shelves free, press a 'send' button and the object will be taken to the closest space, the next object to the 2nd closest space etc. I then want to retrieve an object from any space too. The idea is that I want to have one 'send' button (sends to nearest space) and I will use a potentiometer and button to retrieve from the desired space I select.

Does anyone have an idea where to begin? Has anyone done anything similar? I'm using CCS compiler and C code.Thanks

Sounds like a school project. What are you going to use for the mechanical actuators, transport mechanism, switch sensors, etc.?
 
No, it's not a ''school project''. The actuators are irrelevant to this question, but they are a combi of DC's and steppers. Switches are micro switches.

Oh how I love the unhelpful responses on this forum. I'm sure if it was a simple ''school'' project then you'd give me a simple ''school'' answer, wouldn't you?
:)
 
axe34 said:
No, it's not a ''school project''. The actuators are irrelevant to this question, but they are a combi of DC's and steppers. Switches are micro switches.

Oh how I love the unhelpful responses on this forum. I'm sure if it was a simple ''school'' project then you'd give me a simple ''school'' answer, wouldn't you?
:)

Not sure why you're offended, but whatever. First, using a potentiometer to select which bin to fetch from sounds very much like a low-end intro schoolwork project. And I asked for clarification, because as you know, schoolwork questions go in the Homework Help forums, and you need to show your work before we can offer tutorial assistance.

Anyway, I don't see how you can say that the mechanical part of this doesn't matter. Is this just a paper design? Or is it just the programming part that you are going to do, with stubs for the parts that would be your I/O routines? How many I/Os would you have if this were a real system?
 
Berkeman is correct. But, what you want is a linear search algorithm. You are working in an embedded system - like a microcontroller, so you have limited memory. I would consider a bit-array, where bit=1 == full, bit=0 == empty. This will not work if there are implied differences in contents of the bin.
Use 16 bit words, uint16_t, you need to map each bin to one and only one bit in the array.

Note: I got the 16 bit suggestion from reading what CCS supports, you should know that cold. I would have used whatever the native word size for the microcontroller is otherwise.

See: https://graphics.stanford.edu/~seander/bithacks.html
Code:
// return -1 all bins are full, else return bin #
int ff_empty(uint16_t *arr, int arrlen)
{
   int i=0;
   int j=0;
   for(i=0; i<arrlen; i++)
   {
       if( arr[i]< 0xffff)
         return (i *16 + ffs( arr[i] ^ 0xffff) ); 
   }
   return -1;
}
If this does not appear to be simple, get some more help. Bit hack every 'algorithm' this way - find first empty, find first full, mark bin empty, mark bin full. Also this does not handle the issues surrounding the number of bins not evenly divisible by 16.
 
Last edited:

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
2K
  • · Replies 37 ·
2
Replies
37
Views
4K
  • · Replies 4 ·
Replies
4
Views
774
  • · Replies 4 ·
Replies
4
Views
2K
Replies
13
Views
4K
  • · Replies 30 ·
2
Replies
30
Views
9K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
813
  • · Replies 20 ·
Replies
20
Views
2K