This repository has been archived by the owner on Oct 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update catkin_ws * Use interval client * Add target publisher for obstacle_1 * Add utility script * Update submodules
- Loading branch information
Rendell Cale
authored
Mar 20, 2019
1 parent
557db62
commit 0ecf873
Showing
7 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
Submodule fluid_fsm
updated
from 947db8 to 717d0c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <ros/ros.h> | ||
#include <gazebo_msgs/ModelStates.h> | ||
#include <geometry_msgs/PoseStamped.h> | ||
#include <geometry_msgs/Point32.h> | ||
#include <std_msgs/String.h> | ||
#include <ascend_msgs/ObstacleBoundingBoxes.h> | ||
#include <functional> | ||
#include <string> | ||
|
||
gazebo_msgs::ModelStates::ConstPtr modelStatesMsg; | ||
void gazeboModelStatesCallback(gazebo_msgs::ModelStates::ConstPtr msg) { | ||
modelStatesMsg = msg; | ||
} | ||
|
||
const std::string model_states_topic = "/gazebo/model_states"; | ||
const std::string target_topic = "perception/target"; | ||
|
||
int main(int argc, char** argv) { | ||
ros::init(argc, argv, "close_obstacle_detector"); | ||
ros::NodeHandle n; | ||
ros::Publisher targetPub = n.advertise<geometry_msgs::Pose>(target_topic, 1); | ||
ros::Subscriber gazeboSub = n.subscribe(model_states_topic, 10, gazeboModelStatesCallback); | ||
|
||
ros::topic::waitForMessage<gazebo_msgs::ModelStates>(model_states_topic, n); | ||
ros::spinOnce(); | ||
|
||
ros::Rate rate(10.f); | ||
while (ros::ok()) { | ||
ros::spinOnce(); | ||
rate.sleep(); | ||
|
||
geometry_msgs::Pose targetMsg; | ||
|
||
const int len = modelStatesMsg->name.size(); | ||
const auto& name = modelStatesMsg->name; | ||
const auto& pose = modelStatesMsg->pose; | ||
for (int i = 0; i < len; i++) { | ||
if (name[i] == "obstacle_1") { | ||
targetPub.publish(pose[i]); | ||
} | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
containerID=$(docker run -it -d \ | ||
-e ROS_MASTER_URI=http://offboard_computer:11311 \ | ||
-e ROS_NAMESPACE=alpha \ | ||
ascendntnu/control_simulator_pc_node bash) | ||
docker network connect control_simulator_default $containerID | ||
echo $containerID | ||
docker attach $containerID |