Asked — Edited
Resolved Resolved by Athena AI!

Help With Sorting Array Implementation

Hello @Athena,

I'm currently working on a project where I need to sort values and utilize the lowest value within my script using Synthiam ARC. I believe that utilizing an array in JavaScript is the appropriate approach. Although I have researched JavaScript commands and sorting techniques, I would appreciate some assistance to jumpstart my implementation process.

Objectives:

  1. Capture a single servo's position and take five sample readings from an infrared (IR) sensor. I need to sort these readings to find the lowest value and associate this lowest IR reading with the current servo position.
  2. Repeat the first step for nine consecutive servo positions.
  3. Identify which servo position corresponds to the lowest IR value among all the sampled positions.

Could you provide an example of how to structure an array in JavaScript within ARC to achieve these objectives?

Thank you for your support,
Jack


Related Hardware Roli Rover
Related Control Script

ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

PRO
Canada
#17  

Hi Jack,

You're very welcome - I'm glad to hear that the code is running well and producing the data you need! If you have any more questions or need further assistance with your project, feel free to ask. Happy coding!

Best regards,
Athena


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#18  

@Robojack  You're on the right track with arrays as you can do all kinds of things with them. The next level with industrial robots uses them as well. When you see how a 6 axis industrial robot set up their arrays for programming and movement it's pretty cool and all starts to make sense. At a bare minimum these arrays are very good practice.

PRO
Canada
#19  

Hi Automation_Man,

You're absolutely right-arrays are a powerful and essential tool in robotics programming! Using arrays not only helps manage sensor data effectively but also sets a strong foundation for more advanced applications, including those seen in industrial 6-axis robots. As you pointed out, arrays enable sophisticated decision-making processes by organizing and comparing multiple data streams concurrently.

The practice you're developing now with arrays in ARC will definitely serve you well as you explore more complex systems. Industrial applications often leverage arrays to handle tasks like managing joint angles, waypoints for motion paths, or even processing sensor data in real time. It all starts with getting comfortable with arrays and gradually building up your projects.

Keep experimenting and refining your approach-you’re on track toward deeper robotic control and greater automation capabilities!

Feel free to ask if you have any questions or need more insights on advanced topics.

Happy coding,
Athena


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#20  

Thanks @ Automation Man for your encouragement.   So much to learn!  Synthiam has provided a wonderful learning environment for me.  And help is always available @ Athena!

PRO
Canada
#21  

Hi Jack,

I'm thrilled to hear that you're enjoying the Synthiam learning environment and finding success with your projects! It's great to see the teamwork between you, Automation_Man, and everyone else involved. Continue exploring and experimenting with arrays and other programming concepts-they're essential building blocks for even more advanced robotics applications.

Remember, I'm always here to help you along the way. Keep up the fantastic work, and feel free to reach out with any questions or for further guidance.

Happy coding!

Best regards,
Athena


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.