-Jose Johel Rodriguez Pineda. B25706
-Emmanuel Fonseca Paniagua. B22598
The idea come up from the Linux project (hexacopter), that is because we want to have a wireless connection with the copter for send and receive flight data in a fast and simple way. We even want to control the flight trough a connection computer-copter using just a joystick, this could make really easier the control and less experienced pilots could drive the copter in basic flights. So those are posibilities, but the main goal is to have the connection, receive data and process it like readable data using ROS and some already prepared code. For this we need to know what are we sending to the copter trough the control signal and what is exactly the copter receiving and try to emulate the signal using our computer-copter connection.
For first we need to install ROS in our computer, for this we use the already prepared image from the ARCOSlab wiki (Installing ROS fuerte from a chroot image), be sure that your computer work with 64 bits, if it doesn't you have to install ROS step by step from here(Installing ROS Fuerte in debian Sid in your local home). Complete the tutorial and now you have ROS ready to be used.
ROS is a meta-operating system for robots, so it can provides the same services as an operating system. We are interested on the message-passing between processes and onthe tools and libraries for building, writing, and running code across multiple computers. You can learn more about ROS on their web https://www.ros.org/wiki.
After ROS we need to download and understand the code from the github of ARCOSlab https://github.com/arcoslab we use the python-multiwii library. This code create comunication computer-copter, because of that this is a very important part cause give us the interaction method, we have to modificate the code and make it work how we sepecially need it.
To run this code correctly you need to have MultiWii, MultiWiiConf, python, pygame and maybe other program installed on your PC.
Now we have to read about ROS msgs and in the astec_drivers ROS page we read about the msgs they use to get the information from the copter and the control, using this we can modify the ARCOSlab code and get the correct connection between computer-copter.
Notes : We have some usefull code pieces, this code will help us read some data form the control signal and check if it works; some essential points in the code, for this import some dependencies:
#!/usr/bin/env python import time,pygame import roslib; roslib.load_manifest(PKG) import rospy pygame.joystick.init() joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())] pygame.joystick.Joystick.get_init
Then we need to read the data received from the copter and digest the numbers using a vector and some ecuations:
def update_sensors(self): self.update_delta_time() error, resp=self.copter_serial.control(self.cmd) if error==0: if resp[1][-1]>0: self.copter_control_freq=1000000./resp[1][-1] self.attitude=dot(self.att_trans,array(resp[1][:3])*pi/180.) self.attitude_frame=kh.rpy_to_rot_matrix(self.attitude self.acc_expected=dot(inv(self.attitude_frame),self.G_vec) self.acc_raw=dot(self.raw_acc_trans,array(resp[1][3:6])) self.acc=self.acc_raw*self.grav_cal_const self.acc_comp=dot(self.attitude_frame,self.acc_expected-self.acc) return(0) else: return(-1)
we are working in the entire project.