diff --git a/launch/sofia_perception.launch b/launch/sofia_perception.launch index befd96f..bddd58c 100644 --- a/launch/sofia_perception.launch +++ b/launch/sofia_perception.launch @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/resources/perception.bag b/resources/perception.bag new file mode 100644 index 0000000..0e10bf9 Binary files /dev/null and b/resources/perception.bag differ diff --git a/scripts/optimize_class.py b/scripts/optimize_class.py index 755b1f3..3ac4853 100644 --- a/scripts/optimize_class.py +++ b/scripts/optimize_class.py @@ -150,7 +150,7 @@ def plot_inputs(self, ax1, col='k'): optim = Fminsearch() optim.load_set(poses_path, tfs_path) - # initial guess for the optimization algorithm written as position + quaternion (x, y, z, qx, qy, qz, qw) + # REPLACE initial guess (t1) for the optimization algorithm written as position + quaternion (x, y, z, qx, qy, qz, qw) with your calculated guess t1 = np.asarray([0, 0, 0, 0, 0, 0, 0]) topt, f = optim.do_optimise_T(t1) diff --git a/scripts/perception_server.py b/scripts/perception_server.py old mode 100644 new mode 100755 index a63b619..58b23fb --- a/scripts/perception_server.py +++ b/scripts/perception_server.py @@ -10,25 +10,29 @@ class SofiaPerception(object): def __init__(self): self.detect_object_srv = rospy.Service('detect_object', DetectObject, self.detect_object) print("DetectObject srv is now available") + self.z = 0.05 rospy.spin() def detect_object(self, req): self.points = ros_numpy.point_cloud2.pointcloud2_to_array(req.input_pc) - z_values = self.points['z'] - mask = ~np.isnan(z_values) * (z_values > self.z) * (z_values < self.z + 0.15) # removing spurious points - self.points = self.points[mask] ######################### ## YOUR CODE GOES HERE ## ######################### + z_values = self.points['z'] + mask = ~np.isnan(z_values) * (z_values > self.z) * (z_values < self.z + 0.15) # removing spurious points + self.points = self.points[mask] + object_centroid = Point() # object_centroid.x = ... # object_centroid.y = ... # object_centroid.z = ... res = DetectObjectResponse() - res.object_centroid = object_centroid + res.object_centroid_yellow = object_centroid + res.object_centroid_green = object_centroid + res.object_centroid_blue = object_centroid return res diff --git a/srv/DetectObject.srv b/srv/DetectObject.srv index 53219c1..c69207e 100644 --- a/srv/DetectObject.srv +++ b/srv/DetectObject.srv @@ -1,3 +1,5 @@ sensor_msgs/PointCloud2 input_pc --- -geometry_msgs/Point object_centroid \ No newline at end of file +geometry_msgs/Point object_centroid_yellow +geometry_msgs/Point object_centroid_green +geometry_msgs/Point object_centroid_blue \ No newline at end of file