7 #ifndef _CONTROLLED_BODY_H
8 #define _CONTROLLED_BODY_H
10 #include <boost/shared_ptr.hpp>
11 #include <boost/foreach.hpp>
12 #include <Moby/Base.h>
13 #include <Moby/Constants.h>
15 #include <Moby/Visualizable.h>
16 #include <Moby/RecurrentForce.h>
33 virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
34 virtual void save_to_xml(
XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects)
const;
37 Ravelin::VectorNd& (*controller)(boost::shared_ptr<ControlledBody> body, Ravelin::VectorNd&, double,
void*);
52 virtual void prepare_to_calc_ode(Ravelin::SharedConstVectorNd& x,
double t,
double dt,
void* data) = 0;
55 virtual void ode(
double t,
double dt,
void* data, Ravelin::SharedVectorNd& dx) = 0;
60 std::list<RecurrentForcePtr> _rfs;
Class that allows for visualizing simulation data.
Definition: Visualizable.h:29
const std::list< RecurrentForcePtr > & get_recurrent_forces() const
Gets the set of recurrent forces applied to this body.
Definition: ControlledBody.h:43
virtual void prepare_to_calc_ode(Ravelin::SharedConstVectorNd &x, double t, double dt, void *data)=0
Prepares to compute the derivative of the body.
Ravelin::VectorNd &(* controller)(boost::shared_ptr< ControlledBody > body, Ravelin::VectorNd &, double, void *)
The controller callback, if any, for this body.
Definition: ControlledBody.h:37
boost::shared_ptr< XMLTree > XMLTreePtr
XML tree smart pointer.
Definition: Types.h:104
std::list< RecurrentForcePtr > & get_recurrent_forces()
Gets the set of recurrent forces applied to this body.
Definition: ControlledBody.h:46
virtual void save_to_xml(XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const
Implements Base::save_to_xml()
Definition: ControlledBody.cpp:137
Simulator for both unarticulated and articulated rigid bodies without contact.
Definition: Simulator.h:40
Superclass for controlled bodies.
Definition: ControlledBody.h:21
virtual void load_from_xml(boost::shared_ptr< const XMLTree > node, std::map< std::string, BasePtr > &id_map)
Loads the body's state via XML.
Definition: ControlledBody.cpp:91
virtual void prepare_to_calc_ode_sustained_constraints(Ravelin::SharedConstVectorNd &x, double t, double dt, void *data)=0
Prepares to compute the derivative of the body (sustained constraints)
boost::weak_ptr< Simulator > simulator
Pointer to the simulator (necessary for applying impulses w/constraints)
Definition: ControlledBody.h:65
virtual void ode(double t, double dt, void *data, Ravelin::SharedVectorNd &dx)=0
Computes the derivative of the body.
void * controller_arg
Argument to be passed to the controller.
Definition: ControlledBody.h:40