View unanswered posts | View active topics It is currently Tue Jul 22, 2014 11:54 pm






Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
IR Seeker 
Author Message
Rookie

Joined: Sat Jun 27, 2009 4:52 pm
Posts: 7
Post IR Seeker
How do you program the robot to use the IR Seeker?
I downloaded the drivers from http://www.hitechnic.com/downloads but have no clue what to do with them, or how to attach them to RobotC.
And I watched the video at CMU FTC training site, but only found Part 2, which assumes you have already set up RobotC to recognize the IR Seeker. How do you get the right information into the Pragma statements?

Thank you,
Very Bewildered Rookie FTC Coach


Wed Oct 21, 2009 10:17 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: IR Seeker
Hiya RoboTeacher,

I assume you downloaded the "RobotC Drivers for HiTechnic Sensors & SMUX"? I am the guy who wrote them. You need to read the documentation that came with it. I made a lot of effort to document the API for all of the drivers. So open your file browser and open the "index.html" in the HTML folder that came with the drivers. On the left of the page, click on "File List" and then select the "HTDIR-driver.h" for the IR Seeker V2 or "HTIRS-driver.h" for the IR Seeker V1.

As you scroll down the list of functions and their usage, you will see links to examples, click on one of them and you'll see a program that tells you how to use the functions.

In the driver suite directory, you can open HTDIR-test1.c for an example of how to use the IR Seeker V2 or HTIRS-test1.c for an example of how to use the IR Seeker V1.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Oct 22, 2009 12:43 am
Profile WWW
Rookie

Joined: Sat Jun 27, 2009 4:52 pm
Posts: 7
Post Re: IR Seeker
OK, I did that, but I still have a couple of problems.
1. I'm so new to RobotC that I don't understand half of what I'm reading.
2. When I open one of the -test1.c programs in RobotC (v 1.46), it doesn't recognize much of the code and returns numerous "Unreferenced function" warnings. Do I need to move the .h files into RobotC? If so, how? Do I have to move something I downloaded into the "Includes" directory? Or do I go into RobotC and have it go out and search for the missing drivers?
3. When I click on Robot -> Motors & Sensors Setup -> Sensors -> Type, this sensor isn't one of the choices.

Thanks,
Still bewildered...


Thu Oct 22, 2009 10:15 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: IR Seeker
Unreferenced functions are not a problem, you can safely ignore them.

The sensor type you should use is Custom I2C.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Oct 23, 2009 1:47 pm
Profile WWW
Rookie

Joined: Sat Jun 27, 2009 4:52 pm
Posts: 7
Post Re: IR Seeker
Custom I2C isn't one of the choices available in the menu.


Mon Oct 26, 2009 5:19 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: IR Seeker
Here's how to do it:

Go to Window->Menu Level and make sure it is set to "Expert"
In the "Motors and Sensors Setup" select the "Device Mgmt NXT" tab and make sure "Allow Custom Designed Sensors" is selected. Next go the "Sensors" tab and select "I2C Custom" from the list.

That ought to do the trick.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Oct 26, 2009 5:40 pm
Profile WWW
Rookie

Joined: Mon Nov 03, 2008 1:45 pm
Posts: 14
Post Re: IR Seeker
Just my 2 cents worth, but the documentation for this stuff is not student-ready. Doxygen may be used in industry for documenting code, but it is little more than pretty-printing the comments from the source - at the expense of making the source comments difficult to read.
I would much prefer that code such as this:

/**
* Read the value of the specified internal sensor, numbered 0-5 and return it.
* @param link the HTIRS port number
* @param sensorNr the internal sensor to read
* @return the signal strength value of the specified sensor or -1 if an error occurred.
*/

was written as:

/* Function: HTIRSreadStrength(tSensors link, byte sensorNr)
* Arguments: link - the HTIRS port number
* sensorNr - the internal sensor to read
* Return Value: the signal strength value of the specified sensor
* or -1 if an error occurred
*/

(of course, the nice white-space I added to the comment block
was stripped from the HTML, but you get the idea)

Also, the existing documentation is mainly a function/data-structure reference.
Where is the overview that describes what an "SMUX" is and what robot
configuration you need to run the example programs? What is the difference
between "HTIRSreadStrength(tSensors link, byte sensorNr)" and
"HTIRSreadStrength(tMUXSensor muxsensor, byte sensorNr)" and why would
you need one or the other?

Finally, it would be ideal if the code examples provided to the teams followed a style
that we expect from the students themselves. I try to stress with my students that
you must document the code concisely but completely such that another student
can easily understand it and apply it to the next problem to solve.

Just my opinion. I'll stop whining now...

_________________
David Burnette
Tigard High School Robotics


Thu Nov 19, 2009 1:26 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: IR Seeker
dgbatths wrote:
Just my 2 cents worth, but the documentation for this stuff is not student-ready. Doxygen may be used in industry for documenting code, but it is little more than pretty-printing the comments from the source - at the expense of making the source comments difficult to read. I would much prefer that code such as this:
You are encouraged to read the HTML documentation that is generated from the doxygen tags.

Quote:
Also, the existing documentation is mainly a function/data-structure reference. Where is the overview that describes what an "SMUX" is and what robot configuration you need to run the example programs? What is the difference between "HTIRSreadStrength(tSensors link, byte sensorNr)" and
"HTIRSreadStrength(tMUXSensor muxsensor, byte sensorNr)" and why would you need one or the other?

A SMUX tutorial is on its way. As for the functions, you don't need one over the other, they both serve different purposes.

Quote:
Finally, it would be ideal if the code examples provided to the teams followed a style that we expect from the students themselves. I try to stress with my students that you must document the code concisely but completely such that another student can easily understand it and apply it to the next problem to solve.

I think you forget that this is a project I do in my spare time. I don't get paid for it by anyone. If you'd like to contribute examples to the project, you're more than welcome to do so. If I think they're good enough, I will include them with the proper credits. If you think you have what it takes to make this project more student friendly, feel free to drop me an email, it's in the top of each source file.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Nov 19, 2009 2:22 pm
Profile WWW
Rookie

Joined: Mon Nov 03, 2008 1:45 pm
Posts: 14
Post Re: IR Seeker
How do you know if you have a V1 or V2 seeker?

_________________
David Burnette
Tigard High School Robotics


Thu Nov 19, 2009 6:17 pm
Profile
Rookie

Joined: Mon Nov 03, 2008 1:45 pm
Posts: 14
Post Re: IR Seeker
I found the answer to my own question.
The instruction sheet that came with the sensor says "IRSeeker V2.0 Feb 2009"
Also, I determined the driver that I downloaded today is set up for a V1 seeker with an I2C address of 0x02.
I modified it for V2 by changing it to 0x10. The seeker now works with the HTIRS-test.c program.
Thanks for your help.

_________________
David Burnette
Tigard High School Robotics


Fri Nov 20, 2009 12:44 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: IR Seeker
The new HT IR Seeker (also known as the HTDIR) uses another driver, the... HTDIR driver. There is no need to change the I2C address in the HTIRS, you can leave that at 0x02. The HTDIR already uses the correct 0x10 address. In the documentation there is a nice list of all the drivers and the sensor they support. Below is a small screenshot of part of it.

Image

You can't skip over the documentation I provide and then complain about the lack of it. There are some major differences between the HTDIR and HTIRS, the HTDIR is capable of a lot more. A quick glance at the API documentation will illustrate my point.

Lest you forget, we're not all based in Oregon, so time zones are something you need to take into account when posting a question and waiting for an answer. When you posted your question
Quote:
How do you know if you have a V1 or V2 seeker?

I was already in bed for more than an hour. The Internet is populated by people outside the US, too, you know.

Thanks,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Nov 20, 2009 2:31 am
Profile WWW
Rookie

Joined: Mon Nov 03, 2008 1:45 pm
Posts: 14
Post Re: IR Seeker
I see that in the documentation now. Since the list was machine generated, the table was sorted by file name not function. I'll be more careful about reading the docs before posting to the forum.

By the way, why not have a single function that returns all of the data from the sensor at once?
If the students want to get the direction and get the signal strength, they need to call two different
functions, each incurring their own time penalty over the I2C bus.

_________________
David Burnette
Tigard High School Robotics


Fri Nov 20, 2009 12:51 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: IR Seeker
dgbatths wrote:
By the way, why not have a single function that returns all of the data from the sensor at once?

Sounds like something for the next release of the driver suite. I'll make a separate one for the modulated and unmodulated signals in the HTDIR library and a single one for the HTIRS.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Nov 20, 2009 1:05 pm
Profile WWW
Rookie

Joined: Thu Nov 19, 2009 1:21 pm
Posts: 11
Post Re: IR Seeker
Our team is a little frustrated at the moment because we are trying to get a reading from the IR Seeker, we believe that it is version 2. We have downloaded the drivers and gotten to the right page in the index. However the test program is full of errors, and RobotC won't let us ignore them. Is there a simpler way to test the IR seeker than this large program? We also looked at the video of getting the robot to chase the IR ball. The program didn't work even though it had no errors. Any help is much appreciated.


Tue Nov 24, 2009 9:17 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: IR Seeker
Please be more specific about "full of errors". If you are talking about the warnings, you can safely ignore them. They have to do with the fact that there are functions in the libraries that are not being used.

Are you using HTDIR-test1.c? That is the program you should be using for the IR Seeker V2. I just loaded it up and it works fine. I am using ROBOTC 2.00.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Nov 25, 2009 2:46 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 22 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.