Robotics StackExchange | Archived questions

Trying to access a single drone suscribed topic value for the entire fleet of drone

Hi there !

I'm working on a fleet of drones in Gazebo, and I'm using ROS to control it (beginner). I have a topic that allows to publish a new target to one of my drones, but not to all. I add this target to a list, but it is not visible by other drones. How can I make this subscribed variable accessible to my entire fleet?

Here are my callback function, the published topic and my target tracking function, which only applies to the intelaerobugwright4 drone in this case.

def target_tracking(self):
    if len(self.target_list)>0:
        last = len(self.target_list) - 1
        target = self.target_list[last]
        self.target_pxyz = np.array([
            target.position.x,
            target.position.y,
            target.position.z])
        self.target_psi = quaternion2psi([
            target.orientation.x,
            target.orientation.y,
            target.orientation.z,
            target.orientation.w])
        TargetDiff = self.target_pxyz - self.state_pxyz
        NormTargetDiff = np.linalg.norm(TargetDiff)
        TargetDiff /= NormTargetDiff
        TargetDiff *= SigmoidLike(NormTargetDiff, self.R_trg, self.d_trg)
        return (TargetDiff*self.freq)
    else:
        return np.zeros(3)

rostopic pub /intelaerobugwright4/newtarget geometrymsgs/Pose

    def callback_target(self,data):
    """
    """
    self.target_list.append(data)

Asked by jofaure on 2022-07-01 03:33:08 UTC

Comments

Answers

Still no answer... Up !

Asked by jofaure on 2022-09-13 09:20:09 UTC

Comments