Send to closest unoccupied space

  • Thread starter Thread starter axe34
  • Start date Start date
  • Tags Tags
    Space
AI Thread Summary
The discussion revolves around a mechanical project aimed at sending objects to the nearest available shelf space using a single 'send' button. Each shelf space will have a button activated by the object's weight, and retrieval will be controlled via a potentiometer. Participants debate the relevance of mechanical components and programming aspects, with suggestions for implementing a linear search algorithm and using a bit-array to track shelf occupancy. The conversation highlights the need for clarity on whether the project is theoretical or practical, emphasizing the importance of understanding both hardware and software components. Effective management of memory and I/O routines is crucial for the project's success.
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:
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top