Continuous signal with crazyflie_ros

Firmware/software/electronics/mechanics
Post Reply
EduardoAguilar
Beginner
Posts: 14
Joined: Tue May 05, 2020 2:05 am

Continuous signal with crazyflie_ros

Post by EduardoAguilar » Tue May 26, 2020 7:14 pm

Hello everyone


I would like to know if you can help me with something,
I am working with crazyflie_ws in the crazyflie_ros folder https://github.com/whoenig/crazyflie_ros, specifically there is a file named pose.publish.py https://github.com/whoenig/crazyflie_ro ... sh_pose.py
and this generates the desired points for x, y and z, but these are only constants,
I would like to know if I can enter a variant signal in time as it is a signal sine,

thank you very much.



EduardoAguilar
Beginner
Posts: 14
Joined: Tue May 05, 2020 2:05 am

Re: Continuous signal with crazyflie_ros

Post by EduardoAguilar » Wed May 27, 2020 6:23 am

Im traying with this pose.publish.py

Code: Select all

#!/usr/bin/env python

import rospy
import math
import tf
from geometry_msgs.msg import PoseStamped

if __name__ == '__main__':
    rospy.init_node('publish_pose', anonymous=True)
    worldFrame = rospy.get_param("~worldFrame", "/world")
    name = rospy.get_param("~name")
    r = rospy.get_param("~rate")
    t = rospy.get_time()
    x = 0
    y = 0
    z = 0.3*math.sin(2*3.1416*0.05*t) + 0.6
    rate = rospy.Rate(r)


    msg = PoseStamped()
    msg.header.seq = 0
    msg.header.stamp = rospy.Time.now()
    msg.header.frame_id = worldFrame
    msg.pose.position.x = x
    msg.pose.position.y = y
    msg.pose.position.z = z
    quaternion = tf.transformations.quaternion_from_euler(0, 0, 0)
    msg.pose.orientation.x = quaternion[0]
    msg.pose.orientation.y = quaternion[1]
    msg.pose.orientation.z = quaternion[2]
    msg.pose.orientation.w = quaternion[3]

    pub = rospy.Publisher(name, PoseStamped, queue_size=1)

    while not rospy.is_shutdown():
        msg.header.seq += 1
        msg.header.stamp = rospy.Time.now()
        pub.publish(msg)
        rate.sleep()

and really i haven't a good results, someone can help me?
thank you!!

when read my topic on rosbag just i have a constant

Code: Select all

z_goal = 0.6
and this is incorrect i think that z_goal maybe will be a sine

kimberly
Bitcraze
Posts: 373
Joined: Fri Jul 06, 2018 11:13 am

Re: Continuous signal with crazyflie_ros

Post by kimberly » Wed May 27, 2020 6:54 am

This thread contains a copy of an issue of https://github.com/whoenig/crazyflie_ros. This is probably a better location for that, although it seems more like a ROS question than a crazyflie_ros question.

Also try to not double post please.

EduardoAguilar
Beginner
Posts: 14
Joined: Tue May 05, 2020 2:05 am

Re: Continuous signal with crazyflie_ros

Post by EduardoAguilar » Wed May 27, 2020 3:44 pm

Thank you Kimberly :)

Post Reply