Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications on HEAR_ROS #1

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
46bf35d
Merge pull request #1 from AhmedHumais/master
HazemElrefaei Jul 25, 2022
b8bba25
Add Bool and Float Clients 25.7.2022
HazemElrefaei Jul 29, 2022
f08f2cc
Updated Bool and Float Clients
HazemElrefaei Jul 29, 2022
86f4f74
return statement added
HazemElrefaei Aug 22, 2022
efdf51a
Add ROSUnit_Client.hpp
HazemElrefaei Aug 23, 2022
9a2a921
UpdateControllerClnt added
HazemElrefaei Aug 31, 2022
05d207d
Fixing NodeHandle calling
HazemElrefaei Sep 1, 2022
29b26e3
Build Trial 1
HazemElrefaei Sep 5, 2022
286ab86
Update HEAR_ROS
HazemElrefaei Sep 20, 2022
47ddfb4
Update ROSUnit_UpdateContClnt.cpp main repository
HazemElrefaei Sep 21, 2022
05e6ca4
Update HEAR_ROS
HazemElrefaei Sep 26, 2022
69cc918
Add Float server
HazemElrefaei Sep 27, 2022
2e02c3c
Update ROSUnit_UpdateContClnt.cpp
HazemElrefaei Oct 6, 2022
f4a9a43
Update RosUnit_MRFTSwitchSrv.hpp
HazemElrefaei Oct 10, 2022
41a28c1
Multiagent and new trajectory
HazemElrefaei Nov 8, 2022
3e9aca0
Bounding Switch Service
HazemElrefaei Dec 5, 2022
32c0d1a
FloatArrSub, multiport, update bounding
HazemElrefaei Dec 13, 2022
46ff0c4
Add initial commands 1000
HazemElrefaei Dec 13, 2022
5c1f354
param.h_o1 to param.h_o2
HazemElrefaei Dec 16, 2022
8e97b96
Modified Ros Package for (V3.0)
HazemElrefaei Mar 21, 2023
a87a719
Comment ROSUnit_UpdateContClnt.hpp
HazemElrefaei Mar 21, 2023
0b60f92
Add samplingType
HazemElrefaei Apr 30, 2023
e8b12e7
Add Float3 Client
HazemElrefaei Apr 30, 2023
5777304
Add Float3 Service
HazemElrefaei Apr 30, 2023
1748b4f
buffer set to 1
May 17, 2023
c4237d7
Merge pull request #2 from MChehadeh/master
HazemElrefaei May 17, 2023
8d74fb8
Add TotalExecutionTime instead of NumSamples
HazemElrefaei May 31, 2023
cbb52a7
Set Const Velocity from MC
HazemElrefaei Jun 1, 2023
23c7196
comment ROSUnit_SLAM for tf2 error
HazemElrefaei Jun 16, 2023
a23fd09
Comment for Pi4
HazemElrefaei Jun 21, 2023
131a266
Merge branch 'master' of https://github.com/HazemElrefaei/HEAR_ROS
HazemElrefaei Jun 21, 2023
41f6446
Add Vision pose
HazemElrefaei Jul 19, 2023
5047350
Optitrack Convention
HazemElrefaei Aug 9, 2023
a84d655
fix vision orientation
HazemElrefaei Aug 15, 2023
bb0e368
remove b_uid
HazemElrefaei Aug 21, 2023
3fefd53
Successful flight test PX4
HazemElrefaei Aug 30, 2023
75fe853
standard trajectory added
HazemElrefaei Aug 30, 2023
c6f94b9
Add PX4 vel and ori
HazemElrefaei Aug 31, 2023
d4fc585
yaw angle corrected PX4
HazemElrefaei Aug 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions hear_ros.cmake
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,28 @@ set(HEAR_ROS_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include)
set(HEAR_ROS_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src)

file(GLOB HEAR_ROS_SRCs ${HEAR_ROS_SOURCE_DIR}/*.cpp)

if(PX4_DEPS)
find_package(catkin REQUIRED COMPONENTS
roscpp
hear_msgs
mavros_msgs
std_srvs
geometry_msgs
tf2_geometry_msgs
tf2
tf2_ros
)
else()
find_package(catkin REQUIRED COMPONENTS
roscpp
hear_msgs
std_srvs
geometry_msgs
tf2_geometry_msgs
tf2
tf2_ros
)
endif()

set(HEAR_ROS_LIBS ${catkin_LIBRARIES})
22 changes: 22 additions & 0 deletions include/HEAR_ROS/ROSUnit_BoolClnt.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef ROSUNIT_BOOLCLNT
#define ROSUNIT_BOOLCLNT

#include <ros/ros.h>
#include <hear_msgs/set_bool.h>
#include "HEAR_core/DataTypes.hpp"
#include "HEAR_ROS/ROSUnit_Client.hpp"
#include <string>

namespace HEAR{

class ROSUnitBoolClient: public ROSUnit_Client<bool>{

public:
ros::NodeHandle nh_;
ROSUnitBoolClient(ros::NodeHandle& nh, std::string);
bool process();
};

}

#endif
4 changes: 2 additions & 2 deletions include/HEAR_ROS/ROSUnit_BoolSrv.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class ROSUnit_BoolServer {
private:
ros::NodeHandle nh_;
ros::ServiceServer m_server;
UpdateTrigger* ext_trig;
ExternalTrigger<BaseMsg>* ext_trig;
bool srv_callback(hear_msgs::set_bool::Request&, hear_msgs::set_bool::Response&);
public:
ROSUnit_BoolServer(ros::NodeHandle&);
UpdateTrigger* registerServer(const std::string&);
ExternalTrigger<BaseMsg>* registerServer(const std::string&);

};

Expand Down
74 changes: 74 additions & 0 deletions include/HEAR_ROS/ROSUnit_BoundingSwitchSrv.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// #ifndef ROSUNIT_BOUNDINGSWITCHSRV_HPP
// #define ROSUNIT_BOUNDINGSWITCHSRV_HPP

// #include <ros/ros.h>
// #include <hear_msgs/set_float.h>

// #include "HEAR_core/ExternalTrigger.hpp"

// #include <string>
// #include <vector>
// #include <utility>


// namespace HEAR{

// class ROSUnit_BoundingSwitchSrv {
// private:
// ExternalTrigger<BaseMsg>* _bounding_trig;
// std::vector <std::pair<ExternalTrigger<BaseMsg>*, bool>> _switch_trig;
// ros::ServiceServer m_server;
// bool srvCallback(hear_msgs::set_float::Request& , hear_msgs::set_float::Response& );
// public:
// ROSUnit_BoundingSwitchSrv(ros::NodeHandle& nh , const std::string& topic_name ){
// m_server = nh.advertiseService(topic_name, &ROSUnit_BoundingSwitchSrv::srvCallback, this);
// _bounding_trig = new ExternalTrigger<BaseMsg>();
// }
// ExternalTrigger<BaseMsg>* getBoundingTrig(){ return _bounding_trig;}
// ExternalTrigger<BaseMsg>* registerSwitchTrig(bool inverted_logic = false){
// auto trig = new ExternalTrigger<BaseMsg>();
// _switch_trig.push_back(std::make_pair(trig, inverted_logic));
// return trig;
// }

// };

// bool ROSUnit_BoundingSwitchSrv::srvCallback(hear_msgs::set_float::Request& req, hear_msgs::set_float::Response& res){
// float data = req.data;
// if(data <= 0){
// BoolMsg msg;
// msg.data = false;
// _bounding_trig->UpdateCallback((BaseMsg*)&msg);
// SwitchMsg sw_msg;
// for (const auto& trig : _switch_trig){
// if(trig.second){
// sw_msg.sw_state = SWITCH_STATE::ON;
// }
// else{
// sw_msg.sw_state = SWITCH_STATE::OFF;
// }
// trig.first->UpdateCallback((BaseMsg*)&sw_msg);
// }

// }
// else{
// BoolMsg msg;
// msg.data = true;
// _bounding_trig->UpdateCallback((BaseMsg*)&msg);
// SwitchMsg sw_msg;
// for (const auto& trig : _switch_trig){
// if(trig.second){
// sw_msg.sw_state = SWITCH_STATE::OFF;
// }
// else{
// sw_msg.sw_state = SWITCH_STATE::ON;
// }
// trig.first->UpdateCallback((BaseMsg*)&sw_msg);
// }
// }
// return true;
// }

// }

// #endif
18 changes: 18 additions & 0 deletions include/HEAR_ROS/ROSUnit_Client.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef ROSUNIT_CLIENT_HPP
#define ROSUNIT_CLIENT_HPP

#include <ros/ros.h>
#include "HEAR_core/DataTypes.hpp"

namespace HEAR{

template <typename T>
class ROSUnit_Client {
public:
T data;
ros::ServiceClient m_client;
virtual bool process() {return true;};
};
}

#endif
28 changes: 14 additions & 14 deletions include/HEAR_ROS/ROSUnit_EmptyClnt.hpp
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#ifndef ROSUNIT_EMPTYCLNT
#define ROSUNIT_EMPTYCLNT
// #ifndef ROSUNIT_EMPTYCLNT
// #define ROSUNIT_EMPTYCLNT

#include <ros/ros.h>
#include <std_srvs/Empty.h>
// #include <ros/ros.h>
// #include <std_srvs/Empty.h>
// #include "HEAR_ROS/ROSUnit_Client.hpp"

namespace HEAR{
// namespace HEAR{

class ROSUnitEmptyClient {
private:
ros::ServiceClient m_client;
public:
ROSUnitEmptyClient(ros::NodeHandle&, std::string);
bool process();
};
// class ROSUnitEmptyClient: public ROSUnit_Client<bool>{
// public:
// ros::NodeHandle nh_;
// ROSUnitEmptyClient(ros::NodeHandle&, std::string);
// bool process();
// };

}
// }

#endif
// #endif
21 changes: 21 additions & 0 deletions include/HEAR_ROS/ROSUnit_Float3Clnt.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef ROSUNIT_FLOAT3CLNT
#define ROSUNIT_FLOAT3CLNT

#include <ros/ros.h>
#include <hear_msgs/set_point.h>
#include "HEAR_core/DataTypes.hpp"
#include "HEAR_ROS/ROSUnit_Client.hpp"
#include <string>

namespace HEAR{

class ROSUnitFloat3Client : public ROSUnit_Client<std::vector<float>>{
public:
ros::NodeHandle nh_;
ROSUnitFloat3Client(ros::NodeHandle&, std::string);
bool process();
};

}

#endif
25 changes: 25 additions & 0 deletions include/HEAR_ROS/ROSUnit_Float3Srv.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef ROSUNIT_FLOAT3SRV_HPP
#define ROSUNIT_FLOAT3SRV_HPP

#include <ros/ros.h>
#include <hear_msgs/set_point.h>
#include <string>

#include "HEAR_core/ExternalTrigger.hpp"

namespace HEAR{
class ROSUnit_Float3Server {
private:
ros::NodeHandle nh_;
ros::ServiceServer m_server;
ExternalTrigger<BaseMsg>* ext_trig;
bool srv_callback(hear_msgs::set_point::Request&, hear_msgs::set_point::Response&);
public:
ROSUnit_Float3Server(ros::NodeHandle&);
ExternalTrigger<BaseMsg>* registerServer(const std::string&);

};

}

#endif
2 changes: 1 addition & 1 deletion include/HEAR_ROS/ROSUnit_FloatArrPub.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ROSUnitFloatArrPub : public ROSUnit_Pub{
private:
public:
ROSUnitFloatArrPub(ros::NodeHandle& nh, const std::string& topic_name, int idx){
pub_ = nh.advertise<std_msgs::Float32MultiArray>(topic_name, 10, true);
pub_ = nh.advertise<std_msgs::Float32MultiArray>(topic_name, 1, true);
_input_port = new InputPort<std::vector<float>>(idx, 0);
id_ = idx;
}
Expand Down
35 changes: 35 additions & 0 deletions include/HEAR_ROS/ROSUnit_FloatArrSub.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef ROSUNIT_FLOATARRSUB_HPP
#define ROSUNIT_FLOATARRSUB_HPP

#include "HEAR_ROS/ROSUnit_Sub.hpp"
#include "std_msgs/Float32MultiArray.h"

#include <vector>

namespace HEAR{

class ROSUnitFloatArrSub : public ROSUnit_Sub{
private:
void callback(const std_msgs::Float32MultiArray::ConstPtr& msg){
((OutputPort<std::vector<float>>*)_output_port)->write(msg->data);
}
public:
ROSUnitFloatArrSub(ros::NodeHandle& nh, const std::string& topic_name, int idx){
sub_ = nh.subscribe<std_msgs::Float32MultiArray>(topic_name, 1, &ROSUnitFloatArrSub::callback, this);
_output_port = new OutputPort<std::vector<float>>(idx, 0);
std::vector<float> _commands {0,0,0,0,0,0};
for (int i = 0; i < 6; i++){
_commands[i] = 1000.0;
}

((OutputPort<std::vector<float>>*)_output_port)->write(_commands);
id_ = idx;
}

TYPE getType(){ return TYPE::FloatVec;}

};

}

#endif
21 changes: 21 additions & 0 deletions include/HEAR_ROS/ROSUnit_FloatClnt.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef ROSUNIT_FLOATCLNT
#define ROSUNIT_FLOATCLNT

#include <ros/ros.h>
#include <hear_msgs/set_float.h>
#include "HEAR_core/DataTypes.hpp"
#include "HEAR_ROS/ROSUnit_Client.hpp"
#include <string>

namespace HEAR{

class ROSUnitFloatClient : public ROSUnit_Client<float>{
public:
ros::NodeHandle nh_;
ROSUnitFloatClient(ros::NodeHandle&, std::string);
bool process();
};

}

#endif
2 changes: 1 addition & 1 deletion include/HEAR_ROS/ROSUnit_FloatPub.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace HEAR{
class ROSUnitFloatPub : public ROSUnit_Pub{
public:
ROSUnitFloatPub(ros::NodeHandle& nh, const std::string& topic_name, int idx) {
pub_ = nh.advertise<std_msgs::Float32>(topic_name, 10);
pub_ = nh.advertise<std_msgs::Float32>(topic_name, 1);
_input_port = new InputPort<float>(idx, 0);
id_ = idx;
}
Expand Down
25 changes: 25 additions & 0 deletions include/HEAR_ROS/ROSUnit_FloatSrv.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef ROSUNIT_FLOATSRV_HPP
#define ROSUNIT_FLOATSRV_HPP

#include <ros/ros.h>
#include <hear_msgs/set_float.h>
#include <string>

#include "HEAR_core/ExternalTrigger.hpp"

namespace HEAR{
class ROSUnit_FloatServer {
private:
ros::NodeHandle nh_;
ros::ServiceServer m_server;
ExternalTrigger<BaseMsg>* ext_trig;
bool srv_callback(hear_msgs::set_float::Request&, hear_msgs::set_float::Response&);
public:
ROSUnit_FloatServer(ros::NodeHandle&);
ExternalTrigger<BaseMsg>* registerServer(const std::string&);

};

}

#endif
2 changes: 1 addition & 1 deletion include/HEAR_ROS/ROSUnit_FloatSub.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ROSUnitFloatSub : public ROSUnit_Sub{
};

ROSUnitFloatSub::ROSUnitFloatSub(ros::NodeHandle& nh, const std::string& topic, int idx){
sub_ = nh.subscribe<std_msgs::Float32>(topic, 10, &ROSUnitFloatSub::callback, this);
sub_ = nh.subscribe<std_msgs::Float32>(topic, 1, &ROSUnitFloatSub::callback, this);
_output_port = new OutputPort<float>(idx, 0);

((OutputPort<float>*)_output_port)->write(0);
Expand Down
Empty file modified include/HEAR_ROS/ROSUnit_Heartbeat.hpp
100644 → 100755
Empty file.
22 changes: 22 additions & 0 deletions include/HEAR_ROS/ROSUnit_IntClnt.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef ROSUNIT_INTCLNT
#define ROSUNIT_INTCLNT

#include <ros/ros.h>
#include "HEAR_core/DataTypes.hpp"
#include <hear_msgs/set_int.h>
#include "HEAR_ROS/ROSUnit_Client.hpp"
#include <string>

namespace HEAR{

class ROSUnitIntClient: public ROSUnit_Client<int>{

public:
ros::NodeHandle nh_;
ROSUnitIntClient(ros::NodeHandle& nh, std::string);
bool process();
};

}

#endif
Loading