GitHub basic tutorial
  • Introduction
  • Khởi động hệ thống Ground station computer - Companion computer (Odroid) - Pixhawk
  • Tao 1 private Folder tu public Folder
  • Tạo folder dev PX4 code
  • PX4 modification
  • MAVROS modification
  • Tạo node I3S_receiver
  • Kết nối đọc dữ liệu trong Pixhawk
  • Terminal Linux Ubuntu
  • Kết nối ROS hai máy tính
  • Build ros package in Odroid
  • Pressure sensor
  • Kết nối camera oCAM trên ROS
  • Cài đặt và sử dụng Matlab 2017b trên Linux Ubuntu
  • Một vài vấn đề trên Windows 7
  • Terminator
  • Upload compiled firmware of Pixhawk from odroid
  • Kết nối internet và Ethernet với Odroid (qua Switch) và 1 card mạng kết nối internet
  • IMU, Camera, Pixhawk connection to odroid
  • Kết nối ssh
  • Tham khao code homography cua Ninad
  • Matlab_2017b_problems
  • Eigen library - Mathematical toolbox for C++
  • Kinh nghiệm chuẩn bị presentation
  • Tap lenh lam viec voi Pixhawk px4
  • Offboard mode in PX4
  • P51 Lenovo, trackpad and trackpoint
  • P51 Lenov, Install Quadro M2200 graphic card
  • Gilab
  • Tao 1 private Folder tu public Folder
  • Ubuntu tips: show desktop by pressing Super + D
  • Install eclipse
  • Windows error
  • How to update Sublime Text 3 in ubuntu 16.04
  • PX4 Pixhawk hardfault
  • Install CUDA for computer with NVIDIA graphic card
  • Install openCV after installing CUDA
  • Meld - tool for file or folder comparison
  • GIT - move a full git repository from one remote sever to another one
  • Jetson Nano Installation
  • Working in Jetson Nano
  • Backup and Restore micro sd card
Powered by GitBook
On this page

Was this helpful?

Tạo node I3S_receiver

Sử dụng code từ beginner _tutorial, thay đổi receiver

#include <ros/ros.h>

#include <sensor_msgs/Joy.h>

#include <geometry_msgs/Twist.h>

#include <geometry_msgs/TwistStamped.h>

#include <std_msgs/Float64.h>

class JoyROV

{

public:

  JoyROV\(\);

  void joyCallback\(const sensor\_msgs::Joy::ConstPtr &joy\);



private:

  ros::NodeHandle nh;        



  ros::Subscriber joySub;



  ros::Publisher angVelPub;

  ros::Publisher throttlePub;

};

JoyROV::JoyROV(){

//nh.setParam\("/mavros/setpoint\_attitude/reverse\_throttle", true\);

joySub = nh.subscribe\("/joy", 10, &JoyROV::joyCallback, this\);



angVelPub = nh.advertise&lt;geometry\_msgs::TwistStamped&gt;\("/mavros/setpoint\_attitude/cmd_vel",10);
throttlePub = nh.advertise&lt;std\_msgs::Float64&gt;\("/mavros/setpoint\_attitude/att_throttle",10);
//reserve\_throttlePub = nh.advertise&lt;bool&gt;\("/mavros/setpoint\_attitude/reverse\_throttle",10\);  

    //param::set\("/mavros/setpoint\_attitude/reverse\_throttle", true\);

// void ros::param::set("/mavros/setpoint_attitude/reverse_throttle", true);

/*

//How to set parameter setpoit\_attitude/reserve\_throttle\(true\) for allowing to send -1.0 throttle???

bool reserve\_throttle\_ok = true;            

nh.setParam\("/mavros/setpoint\_attitude/reserve\_throttle", reserve\_throttle\_ok\);

/\*if \(nh.setParam\("/mavros/setpoint\_attitude/reserve\_throttle", reserve\_throttle\_ok\)\)

{

    ROS\_INFO\("Set sucessful param"\);

};\*/

}

void JoyROV::joyCallback(const sensor_msgs::Joy::ConstPtr &joy){

//ROS\_INFO\("I received: \[%f\]", joy-&gt;axes\[0\]\);    



geometry\_msgs::TwistStamped TwistStampedMsg;

TwistStampedMsg.twist.angular.x = joy-&gt;axes\[2\];// ROS\_INFO\("roll ang.vel received: \[%f\]" , TwistStampedMsg.twist.angular.x\);

TwistStampedMsg.twist.angular.y = joy-&gt;axes\[3\];// ROS\_INFO\("pitch ang.vel received: \[%f\]", TwistStampedMsg.twist.angular.y\);

TwistStampedMsg.twist.angular.z = joy-&gt;axes\[0\]; 

angVelPub.publish\(TwistStampedMsg\);



std\_msgs::Float64 throttleMsg;

throttleMsg.data = joy-&gt;axes\[1\];// ROS\_INFO\("throttle received: \[%f\]", throttleMsg.data\);

throttlePub.publish\(throttleMsg\);        

ROS\_INFO\("Debug: % 1.6f % 1.6f % 1.6f % 1.6f ", TwistStampedMsg.twist.angular.x, TwistStampedMsg.twist.angular.y, TwistStampedMsg.twist.angular.z, throttleMsg.data);

}

int main(int argc, char** argv){

ros::init\(argc, argv, "I3S\_receiver"\);

JoyROV I3S\_receiver;



ros::spin\(\);

return 0;

}

PreviousMAVROS modificationNextKết nối đọc dữ liệu trong Pixhawk

Last updated 5 years ago

Was this helpful?