Skip to content

Commit

Permalink
Modified trajectory iteration message.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykcieslak committed Nov 25, 2020
1 parent 9a0c128 commit ef0ed0b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pkg_check_modules(Stonefish REQUIRED stonefish>=1.2.0)

add_message_files(
FILES
Int32Stamped.msg
ThrusterState.msg
)

Expand Down
2 changes: 2 additions & 0 deletions msg/Int32Stamped.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Header header
int32 data
7 changes: 4 additions & 3 deletions src/ROSInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <Stonefish/comms/USBL.h>
#include <Stonefish/entities/AnimatedEntity.h>

#include <std_msgs/UInt32.h>
#include <sensor_msgs/FluidPressure.h>
#include <sensor_msgs/Imu.h>
#include <sensor_msgs/Range.h>
Expand All @@ -62,6 +61,7 @@
#include <visualization_msgs/MarkerArray.h>
#include <cola2_msgs/DVL.h>
#include <cola2_msgs/Float32Stamped.h>
#include <stonefish_ros/Int32Stamped.h>

#include <Eigen/Core>
#include <Eigen/Dense>
Expand Down Expand Up @@ -421,8 +421,9 @@ void ROSInterface::PublishTrajectoryState(ros::Publisher& odom, ros::Publisher&
odom.publish(msg);

//Iteration message
std_msgs::UInt32 msg2;
msg2.data = tr->getPlaybackIteration();
stonefish_ros::Int32Stamped msg2;
msg2.header = msg.header;
msg2.data = (int32_t)tr->getPlaybackIteration();
iter.publish(msg2);
}

Expand Down
4 changes: 2 additions & 2 deletions src/ROSScenarioParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <Stonefish/sensors/vision/MSIS.h>
#include <Stonefish/comms/Comm.h>
#include <std_msgs/Float64.h>
#include <std_msgs/UInt32.h>
#include <sensor_msgs/FluidPressure.h>
#include <sensor_msgs/Imu.h>
#include <sensor_msgs/Range.h>
Expand All @@ -58,6 +57,7 @@
#include <cola2_msgs/DVL.h>
#include <cola2_msgs/Setpoints.h>
#include <stonefish_ros/ThrusterState.h>
#include <stonefish_ros/Int32Stamped.h>

#include <ros/package.h>

Expand Down Expand Up @@ -305,7 +305,7 @@ bool ROSScenarioParser::ParseAnimated(XMLElement* element)
return true;
}
pubs[nameStr + "/odometry"] = nh.advertise<nav_msgs::Odometry>(std::string(topic), 10);
pubs[nameStr + "/iteration"] = nh.advertise<std_msgs::UInt32>(std::string(topic) + "/iteration", 10);
pubs[nameStr + "/iteration"] = nh.advertise<stonefish_ros::Int32Stamped>(std::string(topic) + "/iteration", 10);
}

return true;
Expand Down

0 comments on commit ef0ed0b

Please sign in to comment.