I’m attempting to transplant a (mostly) working MWE of home-to-switch into our multithreaded application.
When I home, it starts OK, and runs (indefinitely long) until the home switch is triggered (stage 1), at which point, Axis::Home() throws an RSI error:
Axis: unable to set command position :: {axis.c, line 949} (Error 258) (RSI::RapidCode::Impl::Axis::CommandPositionSet) (Object 0) (File …..\source\axis.cpp) (Line 754) (Version 8.1.3 for 04.04.02.RMP)
I am attempting to suppress all other “commands” for the axis from other threads in my application. There are no active user limits while Axis::Home() is executing. At the point of the error, the axis object is in the STOPPED state. I am using RSIHomeMethodRISING_HOME_POSITIVE_START as the method. I have effectively done everything outlined in the Axis::Home() doc.
Any guesses as to what I might be doing that could cause this error?
You can’t set Commanded position when in the Stopped state as a safety precaution. A stopped move could be resumed which after a CommandPositionSet would cause unknown likely dangerous behavior. Calling ClearFaults would clear the Stopped move and allow CommandPositionSet to take place.
The thread that raises the exception is inside Axis::Home(). The other threads are basically told, “Hands off!” until homing is finished.
I’m attempting not to do any command/set actions, so I’m not sure which thread might be at fault. Are there a limited number of APIs I could try to break on that would result in an attempt to set commanded position? Is Axis::CommandPositionSet() the only one? (I’m not actually calling that function anywhere.) I’m inhibiting the call to MotionController::MovePT() during homing.
Internal to the Home() function, we’re use CommandPositionSet(0.0). Just before that we check to see if we are stopped and clear faults if so. I believe we’re either in the STOPPING state with some unrealistic setting or that one of the other treads is causing the limits to re-trigger during the Home process.
Yes, that is our issue. Home will not work with an axis in a MultiAxis Object. Those will propagate the limit related events re-triggering stop over and over. Our ClearFaults before Command Position set will not matter.
You’ll want to do Homing before setting up the MultiAxis, unmap/delete the MultiAxis for homing before recreating it afterwards, or setup a custom homing routine that clears the MultiAxis object that the node is a part of.