Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <behaviors/Ground.hpp>
00009
00010 #include <telekyb_defines/physic_defines.hpp>
00011
00012
00013 PLUGINLIB_DECLARE_CLASS(tk_behavior, Ground, telekyb_behavior::Ground, TELEKYB_NAMESPACE::Behavior);
00014
00015 namespace telekyb_behavior {
00016
00017 Ground::Ground()
00018 : Behavior("tk_behavior/Ground", BehaviorType::Ground)
00019 {
00020
00021 }
00022
00023 void Ground::initialize()
00024 {
00025 controller = TrajectoryController::InstancePtr();
00026 tDoMassEstimation = OptionContainer::getGlobalOptionByName<bool>("TrajectoryController","tDoMassEstimation");
00027 if (!tDoMassEstimation) {
00028 ROS_ERROR("Unable to get Option TrajectoryController/tDoMassEstimation. Quitting...");
00029 ros::shutdown();
00030 } else {
00031
00032 parameterInitialized = true;
00033 }
00034 }
00035
00036 void Ground::destroy()
00037 {
00038
00039 }
00040
00041
00042
00043 bool Ground::willBecomeActive(const TKState& currentState, const Behavior& previousBehavior)
00044 {
00045
00046
00047
00048
00049
00050 tDoMassEstimation->setValue(false);
00051
00052
00053 return true;
00054 }
00055
00056 void Ground::didBecomeActive(const TKState& currentState, const Behavior& previousBehavior)
00057 {
00058
00059 }
00060
00061 void Ground::willBecomeInActive(const TKState& currentState, const Behavior& nextBehavior)
00062 {
00063
00064
00065 tDoMassEstimation->setValue(true);
00066 }
00067
00068 void Ground::didBecomeInActive(const TKState& currentState, const Behavior& nextBehavior)
00069 {
00070
00071 }
00072
00073
00074 void Ground::trajectoryStepCreation(const TKState& currentState, TKTrajectory& generatedTrajInput)
00075 {
00076
00077 trajectoryStepActive(currentState,generatedTrajInput);
00078 }
00079
00080
00081 void Ground::trajectoryStepActive(const TKState& currentState, TKTrajectory& generatedTrajInput)
00082 {
00083 generatedTrajInput.setAcceleration( Acceleration3D(0.0, 0.0, GRAVITY) );
00084 generatedTrajInput.setYawRate(0.0);
00085 }
00086
00087
00088 void Ground::trajectoryStepTermination(const TKState& currentState, TKTrajectory& generatedTrajInput)
00089 {
00090
00091 trajectoryStepActive(currentState,generatedTrajInput);
00092 }
00093
00094
00095 bool Ground::isValid(const TKState& currentState) const
00096 {
00097
00098 return true;
00099 }
00100
00101
00102
00103 }