Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102812455
control_proxy_node.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 24, 10:46
Size
1 KB
Mime Type
text/x-c++
Expires
Wed, Feb 26, 10:46 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24431374
Attached To
R1517 test_package
control_proxy_node.hpp
View Options
#ifndef CONTROL_PROXY_NODE_HPP
#define CONTROL_PROXY_NODE_HPP
#include "ros/ros.h"
#include "std_msgs/Int32MultiArray.h"
#include "std_msgs/Int16MultiArray.h"
#include "test_package/aircraft_controls.h"
#include "boost/thread/mutex.hpp"
class ControlProxyNode
{
public:
ControlProxyNode(const ros::NodeHandle &_nh);
virtual ~ControlProxyNode(){}
void publish(){ proxy_pub.publish(servo_msg); }
void set_servos(const int &thrust, const int &elevator,
const int &rudder, const int &ailerons)
{
servo_msg.data.clear();
servo_msg.data.push_back( static_cast<uint16_t>(thrust) );
servo_msg.data.push_back( static_cast<uint16_t>(elevator) );
servo_msg.data.push_back( static_cast<uint16_t>(rudder) );
servo_msg.data.push_back( static_cast<uint16_t>(ailerons) );
}
private:
std_msgs::Int16MultiArray servo_msg;
void controlCallback(const test_package::aircraft_controls::ConstPtr& msg);
ros::Subscriber proxy_sub;
ros::Publisher proxy_pub;
std::shared_ptr<ros::NodeHandle> nh;
boost::mutex m_mutex;
};
#endif // CONTROL_PROXY_NODE_HPP
Event Timeline
Log In to Comment