data from SLAM(ROS)

Firmware/software/electronics/mechanics
RyanMco
Expert
Posts: 158
Joined: Tue Apr 09, 2019 6:15 am

Re: data from SLAM(ROS)

Post by RyanMco »

once I run the second script, the crazyflie just moving its motors and it's staying on the ground not hovering ..
ofcourse Im doing that while slam is working (getting data from slam)

RyanMco
Expert
Posts: 158
Joined: Tue Apr 09, 2019 6:15 am

Re: data from SLAM(ROS)

Post by RyanMco »

Any help?! Im still stuck helpers !

arnaud
Bitcraze
Posts: 2275
Joined: Tue Feb 06, 2007 12:36 pm

Re: data from SLAM(ROS)

Post by arnaud »

My input would be to try to debug your system step by step: I already pointed-out the type of packet that is sent for sending external position to the Crazyflie, you could put a printf at that point to make sure the packet is indeed sent.

On the Crazyflie side you can look at the external position log variables to make sure the data makes it to the Crazyflie: https://github.com/bitcraze/crazyflie-f ... #L247-L251

Then, in the Crazyflie again, you should look at the estimated position before attempting any flight: https://github.com/bitcraze/crazyflie-f ... #L629-L632. If the position estimate does not make sense, autonomous flight will not work.

RyanMco
Expert
Posts: 158
Joined: Tue Apr 09, 2019 6:15 am

Re: data from SLAM(ROS)

Post by RyanMco »

Really appreciate your effort to answer.
but I have changed a lil in my scripts as I pointed before, is there a problem with them? maybe Im forgetting something in the code that I wrote itself?!
I have changed a lil in the code that you pointed before about sending external position .. maybe my new code is having a problem?

arnaud
Bitcraze
Posts: 2275
Joined: Tue Feb 06, 2007 12:36 pm

Re: data from SLAM(ROS)

Post by arnaud »

It is hard to debug such a script without the actual system.

You need to check that the position you are sending is indeed sent to the Crazyflie, this is the first step to debug your problem and I sent you pointers of how to do so earlier. This will allow you to locate where the problem is.

RyanMco
Expert
Posts: 158
Joined: Tue Apr 09, 2019 6:15 am

Re: data from SLAM(ROS)

Post by RyanMco »

but lets assume that I run this script python using data from ROS*SLAM*
import rospy
import crazyflie
import time
import uav_trajectory

if __name__ == '__main__':
rospy.init_node('test_high_level')

cf = crazyflie.Crazyflie("crazyflie3", "crazyflie3")

cf.setParam("commander/enHighLevel", 1)

cf.takeoff(targetHeight = 0.2, duration = 2.0)
time.sleep(5.0)
cf.goTo(goal = [0.5, 0.0, 0.0], yaw=0.2, duration = 2.0, relative = True)
time.sleep(5.0)
cf.land(targetHeight = 0.0, duration = 2.0)


where does this instruction "cf.goTo(goal = [0.5, 0.0, 0.0], yaw=0.2, duration = 2.0, relative = True)" sent to crazyflie? at which functions? I mean is it sent like ROS TF MESSAGE? it should be setpoint? could you please help me at which function in my firmware once I run that instruction could find the set point data 0.5 0.0 0.0


thanks !

arnaud
Bitcraze
Posts: 2275
Joined: Tue Feb 06, 2007 12:36 pm

Re: data from SLAM(ROS)

Post by arnaud »

See my answer in your other thread where I point the place in the code where the goto packet is received: viewtopic.php?f=6&t=3987&p=18179#p18179

Post Reply