Commit 9a453c96 authored by Helge's avatar Helge
Browse files

Fixed test cases

parent c8e12053
Pipeline #187160 passed with stages
in 2 minutes and 11 seconds
......@@ -106,11 +106,11 @@ class RosAdapter_tests_structs_arrayHandlingComp: public IAdapter_tests_structs_
int counter = 0;
for(int i0 = 0; i0 < 1; i0++){
for(int i1 = 0; i1 < 7; i1++){
if(2 <= counter && counter <= 6){
(component->in4)(i0, i1-2) = msg->poses[counter].pose.orientation.x;
if(2-1 <= counter && counter <= 6-1){
(component->in4)(i0, i1-2-1) = msg->poses[counter].pose.orientation.x;
}
else if(2 > counter){
(component->in4)(i0, i1+6-2+1) = 0;
else if(2-1 > counter){
(component->in4)(i0, i1+6-1-2-1+1) = 0;
}
else{
(component->in4)(i0, i1) = 0;
......@@ -154,4 +154,4 @@ class RosAdapter_tests_structs_arrayHandlingComp: public IAdapter_tests_structs_
publish_name6Publisher();
}
};
};
\ No newline at end of file
......@@ -6,7 +6,9 @@
#include <std_msgs/Bool.h>
#include <std_msgs/Float64.h>
#include <std_msgs/Int32.h>
class RosAdapter_tests_msg_basicTypesComp: public IAdapter_tests_msg_basicTypesComp{
tests_msg_basicTypesComp* component;
ros::Subscriber topic7Subscriber;
ros::Subscriber topic8Subscriber;
......@@ -26,48 +28,54 @@ class RosAdapter_tests_msg_basicTypesComp: public IAdapter_tests_msg_basicTypesC
int i = 0;
ros::init(i, &tmp, "RosAdapter_tests_msg_basicTypesComp_node");
ros::NodeHandle node_handle = ros::NodeHandle();
topic7Subscriber = node_handle.subscribe("topic7", 5, &RosAdapter_tests_msg_basicTypesComp::topic7Callback, this, ros::TransportHints().tcpNoDelay());
topic8Subscriber = node_handle.subscribe("topic8", 5, &RosAdapter_tests_msg_basicTypesComp::topic8Callback, this, ros::TransportHints().tcpNoDelay());
topic9Subscriber = node_handle.subscribe("topic9", 5, &RosAdapter_tests_msg_basicTypesComp::topic9Callback, this, ros::TransportHints().tcpNoDelay());
topic7Publisher = node_handle.advertise<std_msgs::Float64>("topic7",5);
topic8Publisher = node_handle.advertise<std_msgs::Int32>("topic8",5);
topic9Publisher = node_handle.advertise<std_msgs::Bool>("topic9",5);
ros::spin();
}
void topic7Callback(const std_msgs::Float64::ConstPtr& msg){
component->inQ = msg->data;
}
void topic8Callback(const std_msgs::Int32::ConstPtr& msg){
component->inZ = msg->data;
}
void topic9Callback(const std_msgs::Bool::ConstPtr& msg){
component->inB = msg->data;
}
void publishtopic7Publisher(){
void topic7Callback(const std_msgs::Float64::ConstPtr& msg){
component->inQ = msg->data;
}
void topic8Callback(const std_msgs::Int32::ConstPtr& msg){
component->inZ = msg->data;
}
void topic9Callback(const std_msgs::Bool::ConstPtr& msg){
component->inB = msg->data;
}
void publishtopic7Publisher(){
std_msgs::Float64 tmpMsg;
tmpMsg.data = component->outQ;
topic7Publisher.publish(tmpMsg);
}
void publishtopic8Publisher(){
std_msgs::Int32 tmpMsg;
tmpMsg.data = component->outZ;
topic8Publisher.publish(tmpMsg);
}
void publishtopic9Publisher(){
std_msgs::Bool tmpMsg;
tmpMsg.data = component->outB;
topic9Publisher.publish(tmpMsg);
}
void tick(){
publishtopic7Publisher();
publishtopic8Publisher();
publishtopic9Publisher();
}
};
void tick(){
publishtopic7Publisher();
publishtopic8Publisher();
publishtopic9Publisher();
}
};
\ No newline at end of file
......@@ -109,4 +109,4 @@ class RosAdapter_tests_structs_matrixTypesComp: public IAdapter_tests_structs_ma
publish_name4Publisher();
}
};
};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment