Where to change the source of actual positions feeding to off-board controller in ROS,

Firmware/software/electronics/mechanics
Post Reply
thanhvu94
Member
Posts: 31
Joined: Fri Mar 24, 2017 6:49 pm

Where to change the source of actual positions feeding to off-board controller in ROS,

Post by thanhvu94 »

Hello everyone,

I'm working on a project in a laboratory which has developped a sensor to estimate the X and Y position of an object. I want to feed the X and Y estimation into the off-board controller of the Crazyflie on ROS to test if it's possible to control or not (while the actual Z and Yaw angle are still provided by VICON). However, I don't know where or which file, which function I need to look into to change the position feeding to the controller. Is there anyone who knows how to do that?

Thank you.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Where to change the source of actual positions feeding to off-board controller in ROS,

Post by arnaud »

Do you already have the Crazyflie flying with VICON using the offboard controller? I guess that this should be your starting point: https://github.com/whoenig/crazyflie_ro ... con.launch.

Then, the crazyflie PID controller gets the Crazyflie position from a tf transform (http://wiki.ros.org/tf). What I would do is to make a ros node that gets the TF frame from VICON, the X/Y information from your sensor and publish a new frame that the controller would then be using to control the Crazyflie position. This could be done as a simple python script. For example, for the loco positioning system, this node was publishing the crazyflie position as a TF transform: https://github.com/bitcraze/lps-ros/blo ... py#L31-L36
thanhvu94
Member
Posts: 31
Joined: Fri Mar 24, 2017 6:49 pm

Re: Where to change the source of actual positions feeding to off-board controller in ROS,

Post by thanhvu94 »

Yes, I have done with the off-board controller using VICON.

Is the source file controller.cpp in the crazyflie_controller package the file which defines and feed the tf of crazyflie to the off-board controller? Or it is in another file?

Thank you.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Where to change the source of actual positions feeding to off-board controller in ROS,

Post by arnaud »

No, controller.cpp is the off-board controller. It receives the TF transform and generates control setpoints (roll/pitch/yaw/thrust) to be sent to the Crazyflie.

The loco positioning file I linked last in my previous post is one example of generating and broadcasting TF transform for the controller. In your case you should not have to modify the controller, at least not as a fist approach.
Post Reply