Dear all,
I have been using the examples of https://github.com/bitcraze/crazyflie-l ... r/examples. In my project I can send commands to the CF2 for exmaple modifying the script ramp.py. On the other hand, with the script basiclog.py I can read pediodically the log of the copter. My problem now is that I do not know how I can read the sensor information by logging function and at the same time send commands to the copter in the same script. I need this functionality to implement a controller like PID or others in a python script to control the copter.
Somebody can help me to this issue
Best regards,
Rafael Socas
Control Commands and Logging in the same python script
Re: Control Commands and Logging in the same python script
You can setup log block callbacks and control the Crazyflie in a loop, the callbacks will be called when a log packet arrives. An example of that can be found in the autonomous sequence example, if you uncomment the start_position_printing line a log block is created and started, then the crazyflie is controlled and logs are received at the same time: https://github.com/bitcraze/crazyflie-l ... ce.py#L151
If you only need one log block, another solution is to use the synchronous API. The multiranger_push.py example controls the Crazyflie velocity using the distances logged from the multiranger: https://github.com/bitcraze/crazyflie-l ... er_push.py.
If you only need one log block, another solution is to use the synchronous API. The multiranger_push.py example controls the Crazyflie velocity using the distances logged from the multiranger: https://github.com/bitcraze/crazyflie-l ... er_push.py.
Re: Control Commands and Logging in the same python script
Thank you so much,
you are very kind. This information is very useful for my project.
Best regards,
Rafael Socas
you are very kind. This information is very useful for my project.
Best regards,
Rafael Socas