ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

PRO
Synthiam
#1  

That question doesn’t make sense for a script. Inverting the direction is an option for a robot skill that uses the servo controls. I provided the link about the servo controls many times to you in the past because I’m on my phone and can’t paste the link now hah:)

but you can’t invert a number. Remember programming uses words and numbers. So you can’t say the number 9 is the number 1. Math numbers are numbers.

so the servo commands in script uses numbers. Numbers are always numbers.

PRO
Canada
#2  

In ARC, inverting the direction of a servo programmatically involves adjusting the servo position values in your script. The "Invert Direction" checkbox in a robot skill's settings typically reverses the servo's movement direction without changing the script. However, if you want to invert the direction programmatically and reflect that change in the robot skill's settings, you would need to use the ControlCommand() function to interact with the skill's settings.

Here's an example of how you might invert the servo direction for port V1 programmatically:

# This script inverts the servo direction for port V1
# by setting the servo position to the opposite of its current value.

# First, get the current servo position for V1
$currentPosition = GetServo(V1)

# Calculate the inverted position
# Assuming the servo range is 1-180, where 90 is the midpoint
$invertedPosition = 180 - $currentPosition + 1

# Set the servo to the inverted position
Servo(V1, $invertedPosition)

# Update the robot skill's settings to reflect the change
# This is a pseudo-command, as the actual command depends on the skill implementation
ControlCommand("Auto Release", "SetInvertDirection", V1, true)

Please note that the last line with ControlCommand() is a pseudo-command and may not directly correspond to an actual command in ARC. The actual command to change the "Invert Direction" checkbox in the settings of a robot skill would depend on the implementation of that skill and whether it exposes such a command for programmatic access.

If the robot skill does not provide a ControlCommand() to change the "Invert Direction" setting, you may not be able to programmatically change the checkbox state. In that case, you would handle the inversion logic within your script as shown above and manually ensure that the checkbox in the skill's settings matches your script's behavior.


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.
#3  

Here is the hypothetical scenario that I was trying to solve without having to bother you to change the Stepper servo skill. If the stepper loses power at say the 1520 position and your limit switch is positioned at the 1 position . Whenever it is powered back up you will be at the 1 position. The stepper cannot go below 1 so it cannot go toward the limit switch, but if I could invert the direction progamaticly then I could just tell it to go to a higher number. Once it hits the limit switch I was going to invert the direction back to normal. I was just trying to make a workaround.

PRO
Synthiam
#4  

No, that’s incorrect. ARC does not move the stepper to calibrate it. The arduino moves the stepper until the limit switch is reached. ARC is always set to 1 when home or calibrate is set.

#5  

Are you saying that I can send the command in ARC to calibrate and it will tell Arduino to move towards limit switch and will stop? Do I need to use number 6 Arduino input for the switch as well, similar to what is done when you ask for Arduino to calibrate on power up? Or do I need to designate an ADC input as a switch for it?

PRO
Synthiam
#6  

It’s the same thing.  Calibrate on startup is the same as sending the command to calibrate. manual explains more.

#7  

Ah finally, I've been trying to get it calibrate for so long by sending the command with no motor movement that it's hard to take in. The new software update is going to make this so much easier and professional. Thanks!