Using getParam() with CrazySwarm

Firmware/software/electronics/mechanics
Post Reply
DJFSU
Beginner
Posts: 5
Joined: Mon Nov 08, 2021 11:23 pm

Using getParam() with CrazySwarm

Post by DJFSU »

Hello!

I am currently an engineering student working on implementing risk-based avoidance algorithms on the CrazyFlie using the CrazySwarm packages.

For my application, I will need the position AND velocity of the drone and an arbitrary obstacle. My implementation works well in simulation since there is a specific function for velocity (cf.velocity()), but I haven't found a great substitution for this function when actually running the python script to the drone.

One idea is to access the state estimate log parameters (stateEstimate.vx, stateEstimate.vy, etc.) but I'm not sure how to use the getParam function properly, and I'm not sure that this is the best method for accessing velocity.

I should note that I am using cmdVelocityWorld to stream continuous updates, so another option is to numerically derive velocity with each loop iteration.

I'm sure there are multiple ways to get this done so I'm mainly wondering which method seems most appropriate to others.
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: Using getParam() with CrazySwarm

Post by kimberly »

Hi!

So I think there is perhaps an slight misunderstanding between the logging, that you want the get and what the 'getparam' function does. Logging variables are different to parameters variables, which is usually only set once in the crazyflie. What you want are the logging variables, which is a stream of data that you can observe and visualize during flight.

I don't think that there is currently a way to get the logging variables from the crazyswarm python library itself. But if you look in 'hover_swarm.launch' you can see that you can set your own logging topic, where you can determine your own logging variables. If you connect with the crazyswarm server with your crazyflie, you can get the logging with

Code: Select all

rostopics echo /cf1/log1
, if you use the hover_swarm.launch example. Then you just need to setup your own logging framework with the ROS tools, or use Rqt_graph

Hope this helps!
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: Using getParam() with CrazySwarm

Post by kimberly »

Just some extra info, I saw that cf.position() in the script also gets the position from the crazyswarm server discussion https://github.com/USC-ACTLab/crazyswar ... ssions/566
Post Reply