Asked
Is there a certain command/parameter that I need to put in Javascript and if possible in Blockly to move axes with different values arrive at the same time? Example: Move servo V1 to 5565 and Move V21 to 8755 at the same time and then arrive at the same time. I know it can be done with Auto Position but I'd like it in Javascript so that I can substitute with a variable and then just keep changing the variable as needed. On a different note is there any way to make servo positions in Auto Position be a variable? This seems like it would be very useful?
Related Hardware EZ-B v4
Related Controls
Script
Auto Position (Gait)
To achieve synchronized servo movements in JavaScript within ARC, where servos with different target positions arrive at their destinations simultaneously, you can utilize the concept of proportional speed adjustment based on the distance each servo needs to travel. Unfortunately, direct support for setting servo speeds individually in JavaScript or Blockly within ARC to ensure simultaneous arrival isn't straightforward due to the scripting environment's limitations. However, you can approximate this behavior by calculating the duration each movement should take based on the furthest distance to travel and setting a delay for the movements accordingly.
Here's a conceptual approach in JavaScript for ARC:
This script is conceptual and requires you to fill in the implementation details, such as how to get the current position of a servo (
getCurrentPosition
), how to move a servo over a specified time (moveServoWithTime
), and how to calculate the time needed for the movement (calculateTime
). These functions depend on your robot's specific capabilities and the APIs provided by ARC for JavaScript.Regarding making servo positions in Auto Position be a variable, ARC's Auto Position skill does not directly support using variables for frame positions through the GUI. However, you can dynamically adjust servo positions by using scripts to modify the positions before executing an action. You would use the
ControlCommand
to set servo positions programmatically before calling the action that uses those positions. This approach requires a combination of scripting and creative use of the Auto Position skill to achieve dynamic behavior based on variables.For Blockly, achieving synchronized servo movements with variable positions would follow a similar conceptual approach, but Blockly's capabilities for complex mathematical calculations and dynamic control are more limited compared to JavaScript. You might need to rely more on predefined movements and scripts for complex behaviors.
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.
@Athena This is a pretty interesting approach doing it with time and it makes sense. One thing that I did notice when setting speed variables for steppers on my metal cutting lathe is that a speed setting of 19 was still too fast and a speed setting of 20 was too slow. I ended up writing my own script to modify the speed exactly how I wanted it. Is there an area in Javascript code that I can modify the mapping of the speed? I also would like to verify that the mapping is linear and not exponential.
What you’re describing is how the autopositon robot skill works. I recommend reading the manual about that robot skill.
Yup, you're right. I managed to use the Auto Position and a separate script to make it work the way I wanted. Thanks