We are attempting to correct "drift" that the copter experiences after take-off. One idea is to use the highly synthesized data from the Kinect's odometry. We pulled odom data from the Kinect using ratabmap_ros, then simulated movement along the x and y axes that is similar to what we are experiencing in flight:
By subscribing to the Kinect's pose, we should be able to adjust pitch and roll in our flight script to hold the vehicle's position.
Monday, November 28, 2016
Tuesday, November 22, 2016
Recording Flights From MultiWii
We are using PyMultiwii to record data as we fly:
We now have some data from a take-off at a frequency of 20Hz:
[roll],[pitch],[yaw],[throttle]
This is a graph of the data for the 20 second:
Between two and four seconds, the yaw goes to 1800 which arms the copter, by the sixth second the throttle is at it's MINTHROTTLE, 1350, and we are increasing the throttle. We take-off at about eight seconds.
This is the take-off in greater detail:
while(True):
self.board.getData(MultiWii.RC) s = str(self.board.rcChannels['roll']) + ", " + str(self.board.rcChannels['pitch']) + ", " + str(self.board.rcChannels['yaw']) + ", " + str(self.board.rcChannels['throttle'])
with open("data.txt", "a") as myfile:
myfile.write(s + "\n")
time.sleep(0.05)
We now have some data from a take-off at a frequency of 20Hz:
[roll],[pitch],[yaw],[throttle]
1501, 1503, 1511, 1331 1501, 1503, 1511, 1339 1501, 1503, 1511, 1347 1501, 1503, 1511, 1359 1501, 1503, 1511, 1367 1501, 1503, 1511, 1371 1501, 1503, 1511, 1384 1501, 1503, 1511, 1390 1501, 1503, 1511, 1397 1501, 1503, 1511, 1411 1501, 1503, 1511, 1431 1501, 1503, 1511, 1439 1501, 1503, 1511, 1447 1501, 1503, 1511, 1456 1501, 1503, 1511, 1462 1501, 1503, 1511, 1465 1501, 1503, 1511, 1468 1501, 1503, 1511, 1478 1501, 1503, 1511, 1478 1501, 1503, 1511, 1478 1501, 1503, 1511, 1481 1501, 1503, 1511, 1487 1501, 1503, 1511, 1490 1501, 1503, 1511, 1490 1501, 1503, 1511, 1490 1501, 1503, 1511, 1490 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1511, 1492 1501, 1503, 1509, 1492 1501, 1503, 1496, 1492 1501, 1503, 1484, 1492 1501, 1503, 1467, 1492 1501, 1503, 1445, 1492 1501, 1503, 1425, 1492 1501, 1503, 1417, 1492 1501, 1503, 1415, 1492 1501, 1503, 1404, 1494 1501, 1503, 1399, 1500 1501, 1503, 1394, 1505 1501, 1503, 1394, 1505 1501, 1503, 1394, 1505 1501, 1503, 1401, 1509 1501, 1503, 1408, 1515 1501, 1503, 1408, 1517 1501, 1503, 1408, 1517 1501, 1503, 1408, 1517 1501, 1503, 1408, 1517 1501, 1503, 1408, 1517 1501, 1503, 1408, 1517 1501, 1503, 1408, 1517 1501, 1503, 1408, 1517
This is a graph of the data for the 20 second:
Between two and four seconds, the yaw goes to 1800 which arms the copter, by the sixth second the throttle is at it's MINTHROTTLE, 1350, and we are increasing the throttle. We take-off at about eight seconds.
This is the take-off in greater detail:
Friday, November 18, 2016
CRIUS AIOP v2 Sensor Config
Problem: Slow reaction to change in yaw; copter rocks back and forth, shakes before take-off, change in mode has no affect.
Solution: Manually configure the orientation of the sensors for the MultiWii (config.h; line ~200):
#define FORCE_ACC_ORIENTATION(X, Y, Z){imu.accADC[ROLL] = -X;
imu.accADC[PITCH] = -Y;
imu.accADC[YAW] = Z;}
#define FORCE_GYRO_ORIENTATION(X, Y, Z)
{imu.gyroADC[ROLL] = Y; imu.gyroADC[PITCH] = -X;
imu.gyroADC[YAW] = -Z;}
#define FORCE_MAG_ORIENTATION(X, Y, Z){
imu.magADC[ROLL] = X; imu.magADC[PITCH] = Y;
imu.magADC[YAW] = -Z;}
Monday, November 7, 2016
Kinect Tutorial
NOTE before starting: I have not done a top to bottom run of this yet. I will be doing it soon though to double check. There may be some things that I left out because I am not a perfect note taker. Just waiting for another SD card so I can do the install without wasting my current progress.
I had to reboot after this as well.
Now we can use ROS. If you are confused on how ROS works, the wiki is great at explaining things but is a little more in depth. I am bad at explaining things but can explain it in a dumb easy to understand way since that is the way I think. I'll put a link to a future post here. I have put together a list of handy commands here to get the kinect up and running in ROS
Here is how you start the core ROS process which will be the "master"
I like to run the process in the foreground and just open a new terminal but that is up to you. In a new terminal you can start the node for the kinect by running
ROS should be publishing topics now. A topic is like a data object or an endpoint of an API. You can see the topics by running
You will notice that one of the endpoints is /camera/rgb/image_color. We can look at the RGB image with image_view like so
That should bring up a small window in which you can see what your Kinect sees in RGB. Now you can mess with it and see some other cool stuff as well since the Kinect node publishes several different data types.
Install Ubuntu 16.04 Xenial on the Pi
Ok, lets do this. First we need to download the image for the Pi. I am betting this will work with the Pi 2 as well but I only tested it on the Pi 3.Here are some links to some of the Pi images:
- Raspberry Pi 2
- Raspberry Pi 3 - Thanks to Ryan Finnie
I used an Ubuntu Laptop to format the SD card and write the image to it. But here is the tutorials from the Raspberry Pi foundation:
Now boot up the raspberry pi. If you used the image from Ryan Finnie, the username/password is ubuntu. You will be prompted to change the password so remember what you change it to.
Install ROS (Kinetic Distro)
We have some updates first
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get upgrade -y | |
#also install desktop if you want | |
sudo apt-get install -y xubuntu-desktop | |
#or sudo apt-get install -y lubuntu-desktop |
Then install ROS and setup your work space
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' | |
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116 | |
sudo apt-get update | |
sudo apt-get install -y ros-kinetic-desktop | |
sudo rosdep init | |
rosdep update | |
# Create ROS workspace | |
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc | |
source ~/.bashrc | |
source /opt/ros/kinetic/setup.bash | |
sudo apt-get install -y python-rosinstall | |
sudo apt-get install -y python-roslaunch |
Install Some ROS Packages
ROS has some packages that you can now install via apt. Here are the ones that I installed to work with the kinect and a few others that are useful as well
I had to reboot after this as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# search for packages | |
sudo apt-cache search ros-kinetic | grep "search term" | |
# Install kinect packages | |
sudo apt-get install -y freenect | |
sudo apt-get install -y ros-kinetic-freenect-camera ros-kinetic-freenect-launch | |
sudo apt-get install -y ros-kinetic-freenect-stack ros-kinetic-libfreenect |
Using Your Kinect With ROS
Here is how you start the core ROS process which will be the "master"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roscore |
I like to run the process in the foreground and just open a new terminal but that is up to you. In a new terminal you can start the node for the kinect by running
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roslaunch freenect_launch freenect.launch |
ROS should be publishing topics now. A topic is like a data object or an endpoint of an API. You can see the topics by running
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rostopic list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rosrun image_view image_view image:=/camera/rgb/image_color |
Bill of Materials
- Raspberry Pi 3
- Kinect for Xbox 360 - I got mine at GameStop for ~$35 w/ the AC adapter
- AC Adapter
- If you don't already have a bunch of Micro USB Cables, you will need one for the raspberry pi
- Keyboard & Mouse for working on the pi
Works Cited
- https://www.youtube.com/watch?v=OqOkpZBOpxY
- http://stackoverflow.com/questions/23901220/how-do-i-get-kinect-depth-image-data-in-centimeters-using-the-libfreenect-python
- http://mathnathan.com/2011/02/depthvsdistance/
- https://groups.google.com/forum/#!topic/openkinect/k6exs5hDyQ4
- http://wiki.ros.org/rosbag/Code%20API
- http://www.cs.bham.ac.uk/internal/courses/int-robot/2015/notes/map.php
- http://wiki.ros.org/kinetic/Installation/Ubuntu
Thursday, November 3, 2016
Subscribe to:
Posts (Atom)