##

JointController.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _GAZEBO_JOINTCONTROLLER_HH_
#define _GAZEBO_JOINTCONTROLLER_HH_
#include <map>
#include <string>
#include <vector>
#include <ignition/msgs.hh>
#include "gazebo/common/PID.hh"
#include "gazebo/common/Time.hh"
#include "gazebo/physics/PhysicsTypes.hh"
#include "gazebo/transport/TransportTypes.hh"
#include "gazebo/msgs/msgs.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
// Forward declare private data values.
class JointControllerPrivate;
class GZ_PHYSICS_VISIBLE JointController
{
public: explicit JointController(ModelPtr _model);
public: virtual ~JointController();
public: void AddJoint(JointPtr _joint);
public: void RemoveJoint(Joint *_joint);
public: void Update();
public: void Reset();
public: void SetJointPosition(
const std::string &_name, double _position, int _index = 0);
public: void SetJointPositions(
const std::map<std::string, double> &_jointPositions);
public: common::Time GetLastUpdateTime() const;
public: std::map<std::string, JointPtr> GetJoints() const;
public: void SetPositionPID(const std::string &_jointName,
const common::PID &_pid);
public: bool SetPositionTarget(const std::string &_jointName,
const double _target);
public: void SetVelocityPID(const std::string &_jointName,
const common::PID &_pid);
public: bool SetVelocityTarget(const std::string &_jointName,
const double _target);
public: bool SetForce(const std::string &_jointName, const double _force);
public: std::map<std::string, common::PID> GetPositionPIDs() const;
public: std::map<std::string, common::PID> GetVelocityPIDs() const;
public: std::map<std::string, double> GetForces() const;
public: std::map<std::string, double> GetPositions() const;
public: std::map<std::string, double> GetVelocities() const;
private: bool OnJointCmdReq(const ignition::msgs::StringMsg &_req,
ignition::msgs::JointCmd &_rep);
private: void OnJointCommand(const ignition::msgs::JointCmd &_msg);
private: void OnJointCmd(ConstJointCmdPtr &_msg);
public: void SetJointPosition(
JointPtr _joint, double _position, int _index = 0);
private: JointControllerPrivate *dataPtr;
};
}
}
#endif
Time.hh
gazebo::physics::JointController::GetPositionPIDs
std::map< std::string, common::PID > GetPositionPIDs() const
Get all the position PID controllers.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::physics::JointController::GetPositions
std::map< std::string, double > GetPositions() const
Get all the position PID set points.
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
TransportTypes.hh
Forward declarations for transport.
gazebo::physics::JointController::Update
void Update()
Update the joint control.
system.hh
msgs.hh
gazebo::physics::JointController::SetJointPositions
void SetJointPositions(const std::map< std::string, double > &_jointPositions)
Set the positions of a set of Joint's.
PhysicsTypes.hh
default namespace for gazebo
gazebo::physics::JointController::Reset
void Reset()
Reset all commands.
gazebo::physics::JointController::GetVelocityPIDs
std::map< std::string, common::PID > GetVelocityPIDs() const
Get all the velocity PID controllers.
gazebo::physics::Joint
Base class for all joints.
Definition: Joint.hh:50
gazebo::physics::JointController::GetJoints
std::map< std::string, JointPtr > GetJoints() const
Get all the joints.
gazebo::physics::JointController::SetPositionPID
void SetPositionPID(const std::string &_jointName, const common::PID &_pid)
Set the position PID values for a joint.
gazebo::physics::JointController::SetVelocityTarget
bool SetVelocityTarget(const std::string &_jointName, const double _target)
Set the target velocity for the velocity PID controller.
gazebo::physics::JointController::SetForce
bool SetForce(const std::string &_jointName, const double _force)
Set the applied effort for the specified joint.
gazebo::physics::JointController::GetVelocities
std::map< std::string, double > GetVelocities() const
Get all the velocity PID set points.
gazebo::common::PID
Generic PID controller class. Generic proportiolnal-integral-derivative controller class that keeps t...
Definition: PID.hh:36
gazebo::physics::JointController::AddJoint
void AddJoint(JointPtr _joint)
Add a joint to control.
gazebo::physics::JointPtr
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
gazebo::physics::JointController::RemoveJoint
void RemoveJoint(Joint *_joint)
Remove a joint from control.
gazebo::physics::JointController::GetLastUpdateTime
common::Time GetLastUpdateTime() const
Get the last time the controller was updated.
gazebo::physics::JointController
A class for manipulating physics::Joint.
Definition: JointController.hh:44
gazebo::physics::JointController::~JointController
virtual ~JointController()
Destructor.
gazebo::physics::JointController::SetVelocityPID
void SetVelocityPID(const std::string &_jointName, const common::PID &_pid)
Set the velocity PID values for a joint.
gazebo::physics::JointController::JointController
JointController(ModelPtr _model)
Constructor.
PID.hh
gazebo::physics::JointController::GetForces
std::map< std::string, double > GetForces() const
Get all the applied forces.
gazebo::physics::JointController::SetJointPosition
void SetJointPosition(const std::string &_name, double _position, int _index=0)
Set the positions of a Joint by name.
gazebo::physics::JointController::SetPositionTarget
bool SetPositionTarget(const std::string &_jointName, const double _target)
Set the target position for the position PID controller.