The ROSMidpointVI class wraps the trep.MidpointVI class to implement a variational integrator with a few extra features for use in a ROS environment. This class is a superset of the trep.MidpointVI class, so see the trep.MidpointVI documentation for a full listing of the class description.
Initializing the ROSMidpointVI class creates a rospy publisher which will automatically publish all trep frames to the /tf topic when step() is called.
Create a new empty mechanical system. system is a valid System object that will be simulation.
solving the DEL equation to advance the integrator.
MidpointVI makes use of multithreading to speed up the calculations. num_threads sets the number of threads used by this integrator. If num_threads is None, the integrator will use the number of available processors reported by Python’s multiprocessing module.
Step the integrator forward by one timestep . This advances the time and solves the DEL equation. The current state will become the previous state (ie, \(t_2 \Rightarrow t_1\), \(q_2 \Rightarrow q_1\), \(p_2 \Rightarrow p_1\)). The solution will be saved as the new state, available through t2, q2, and p2. lambda will be updated with the new constraint force, and u1 will be updated with the value of u1. The frames are also published to the /tf topic.
lambda1 and q2 can be specified to seed the root solving algorithm. If they are None, the previous values will be used.
The method returns the number of root solver iterations needed to find the solution.
Raises a ConvergenceError exception if the root solver cannot find a solution after max_iterations.
Calls the rospy.Rate.sleep() method set to timestep of the ROSMidpointVI class. This method attempts to keep a loop at the specified frequency accounting for the time used by any operations during the loop.
Raises a rospy.ROSInterruptException exception if sleep is interrupted by shutdown.