Go to Post Please excuse his spelling/grammar, he's an engineering student. - MrForbes [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-06-2016, 16:47
Jayd009's Avatar
Jayd009 Jayd009 is online now
Registered User
AKA: Jonathan
FRC #4468 (Fernbank LINKS)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Atlanta, Georgia
Posts: 27
Jayd009 is on a distinguished road
Question Vision Tracking Question

Hello everyone,

This summer, my team is going to add a high goal shooter and vision tracking system to our robot. The vision system will consist of a Raspberry Pi 2, an Axis camera, and one ring light. The Raspberry Pi 2 will run GRIP and report the values back to the RoboRIO. However, my question is how can I configure the robot so that GRIP will start as soon as the robot turns on? I understand that this may be impossible, but it would be very helpful so if we make it to eliminations at GRITS (Georgia Robotics Invitational Tournament and Showcase), we don't have to spend time manually turning on GRIP after we switch out the batteries.

Thanks,

Jonathan
__________________
2016: District Event Winner @ Columbus District Qualifier (PCH)
2016: Engineering Inspiration Award @ Peachtree District State Championship
2016: Tesla Subdivision Playoffs Appearance @ FIRST Championship


Reply With Quote
  #2   Spotlight this post!  
Unread 17-06-2016, 17:32
FlamingSpork FlamingSpork is offline
Eating Utensil
FRC #3003 (Tan[X])
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Canandaigua, NY
Posts: 64
FlamingSpork is just really niceFlamingSpork is just really niceFlamingSpork is just really niceFlamingSpork is just really niceFlamingSpork is just really nice
Re: Vision Tracking Question

If you're running GRIP on the RasPi, you can set GRIP as a scheduled task.

You would connect to the Pi, and run "crontab -e", then edit it so that it has a line like this:
Code:
@reboot java -jar /home/pi/grip.jar <or whatever your GRIP command is>
That command will be run whenever the Pi turns on.
Reply With Quote
  #3   Spotlight this post!  
Unread 20-06-2016, 00:10
BrianAtlanta's Avatar
BrianAtlanta BrianAtlanta is offline
Registered User
FRC #1261
Team Role: Mentor
 
Join Date: Apr 2014
Rookie Year: 2012
Location: Atlanta, GA
Posts: 70
BrianAtlanta has a spectacular aura aboutBrianAtlanta has a spectacular aura about
Re: Vision Tracking Question

We used a similar setup, but a USB camera. We helped out a team that had problems with using the IP camera. Turned out the the PI would boot faster than the camera. This caused problems. We helped them trouble shoot the issue, and a ping was setup to detect if the camera was responding before starting vision processing. I think they used openCV directly and not GRIP.

This might not be a problem for you, but after you get things working, I would suggest that you unplug the camera and boot up the pi. Then after GRIP starts, plug in the camera. If it works, GREAT. If not, add some method of detecting if the camera is booted up before starting GRIP.
__________________
Reply With Quote
  #4   Spotlight this post!  
Unread 20-06-2016, 10:17
GreyingJay GreyingJay is offline
Robonut
AKA: Mr. Lam
FRC #2706 (Merge Robotics)
Team Role: Mentor
 
Join Date: Mar 2015
Rookie Year: 2015
Location: Ottawa, Canada
Posts: 776
GreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond repute
Re: Vision Tracking Question

We did something similar with some OpenCV code our team wrote and published called Trackerbox2.

https://github.com/FRC2706/TrackerBox2

The Pi 2 is set up via scripts to start trackerbox2 when it powers on. It waits for the IP camera to be available by pinging it first.
__________________
"If I'm going to mentor someone, I'm going to be involved in their life as a positive force." -Mechvet
Reply With Quote
  #5   Spotlight this post!  
Unread 21-06-2016, 22:24
prensing prensing is offline
Registered User
AKA: Paul Rensing
FRC #2877 (LigerBots)
Team Role: Mentor
 
Join Date: Mar 2015
Rookie Year: 2014
Location: United States
Posts: 14
prensing is an unknown quantity at this point
Re: Vision Tracking Question

You can also put start up code in /etc/rc.local. That will run at the end of boot. But as others have said, you might need to wait on the camera to be up.

However you start it, I suggest you put that code into a bash script (or similar) so that all the logic is in one place. So something like:
/usr/local/sbin/startGRIP
If you put it in /etc/rc.local, end the line with "&" so that it spawns a separate process and does not keep the boot waiting.
Reply With Quote
  #6   Spotlight this post!  
Unread 22-06-2016, 12:40
David Lame David Lame is offline
Registered User
FRC #0247
 
Join Date: Feb 2015
Location: Berkley, MI
Posts: 86
David Lame is a jewel in the roughDavid Lame is a jewel in the roughDavid Lame is a jewel in the roughDavid Lame is a jewel in the rough
Re: Vision Tracking Question

We used vision tracking this season, but we want to port it to a Raspberry Pi and OpenCV.

I'm curious why people seem to want to use an IP camera or a USB camera with the PI. What's wrong with the Pi camera module?

I know that it has a bit of a "fish eye" issue, but that's correctable with camera calibration. From what I've read, USB cameras with the PI are significantly slower, but I haven't verified that myself, and I just read it on the internet, so take that for what it's worth
Reply With Quote
  #7   Spotlight this post!  
Unread 22-06-2016, 14:37
GreyingJay GreyingJay is offline
Robonut
AKA: Mr. Lam
FRC #2706 (Merge Robotics)
Team Role: Mentor
 
Join Date: Mar 2015
Rookie Year: 2015
Location: Ottawa, Canada
Posts: 776
GreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond repute
Re: Vision Tracking Question

Quote:
Originally Posted by David Lame View Post
I'm curious why people seem to want to use an IP camera or a USB camera with the PI. What's wrong with the Pi camera module?

I know that it has a bit of a "fish eye" issue, but that's correctable with camera calibration. From what I've read, USB cameras with the PI are significantly slower, but I haven't verified that myself, and I just read it on the internet, so take that for what it's worth
In retrospect, yes, we should maybe have explored this option further. The choice of hardware was dictated more by what was available to us at the time.

We mounted our IP camera on a servo-controlled pan/tilt module. The intent was that camera image would be picked up by the Pi, it would perform its image processing, and send targeting data to the RoboRio via a TCP connection. The RoboRio could then command the servos to move the camera if needed. We thought we would move the camera to stay with the target it was tracking, and/or have an override by the operator to look around.

In the end we more or less fixed the camera position and didn't end up using all the features we built into it.
__________________
"If I'm going to mentor someone, I'm going to be involved in their life as a positive force." -Mechvet
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:53.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi