##

HydraPlugin.hh
Go to the documentation of this file.
/*
* Copyright (C) 2014 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_PLUGINS_HYDRAPLUGIN_HH_
#define GAZEBO_PLUGINS_HYDRAPLUGIN_HH_
#include <mutex>
#include <thread>
#include <ignition/math/Filter.hh>
#include <ignition/math/Quaternion.hh>
#include <ignition/math/Vector3.hh>
#include <gazebo/common/Plugin.hh>
namespace gazebo
{
class GAZEBO_VISIBLE RazerHydra : public WorldPlugin
{
public: RazerHydra();
public: virtual ~RazerHydra();
// Documentation Inherited.
public: void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf);
private: bool Poll(float _lowPassCornerHz = 5.0);
private: void Run();
private: void Update();
private: int16_t rawPos[6];
private: int16_t rawQuat[8];
private: uint8_t rawButtons[2];
private: double rawAnalog[6];
private: int hidrawFd;
private: ignition::math::Vector3d pos[2];
private: ignition::math::Quaterniond quat[2];
private: ignition::math::OnePoleVector3 filterPos[2];
private: ignition::math::OnePoleQuaternion filterQuat[2];
private: float analog[6];
private: uint8_t buttons[14];
private: ignition::math::OnePole<float> periodEstimate;
private: common::Time lastCycleStart;
// Pointer to the update event connection
private: event::ConnectionPtr updateConnection;
private: std::mutex mutex;
private: std::thread *pollThread;
private: bool stop;
private: transport::NodePtr node;
private: transport::PublisherPtr pub;
};
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
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::transport::PublisherPtr
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
gazebo::RazerHydra
Definition: HydraPlugin.hh:31
gazebo::WorldPlugin
A plugin with access to physics::World. See reference.
Definition: Plugin.hh:278
gazebo::transport::NodePtr
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::physics::WorldPtr
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
Plugin.hh
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59
gazebo::gui::stop
void stop()