View unanswered posts | View active topics It is currently Tue Sep 30, 2014 5:56 pm






Reply to topic  [ 14 posts ] 
HiTechnic NXT IRReceiver Sensor help 
Author Message
Rookie

Joined: Sat Oct 06, 2012 3:30 am
Posts: 7
Post HiTechnic NXT IRReceiver Sensor help
Hi everybody,
I'm completely new to robotc and I'm more pushed to this platform because I've build the NXT Segway with dIMU (dexter). Before building of the segway I could use the IRReceiver in NXT and that worked and was also to understand. Now I use robotc for the Segway and I want to use the IRReceiver for steering the segway but can't find any info how to use the Hitech IRReceiver in robotc.
Please can anybody helkp me with some sample code to start with so that I can learn a little bit of it?

Thanks


Sat Oct 06, 2012 3:39 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: HiTechnic NXT IRReceiver Sensor help
Download the driver suite from the link in my signature and take a look at the hitechnic-irrecv-test1.c program. It will explain to you how to use this sensor.

Make sure you are using ROBOTC 3.51 or later.

- 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]


Sat Oct 06, 2012 4:22 pm
Profile WWW
Rookie

Joined: Sat Oct 06, 2012 3:30 am
Posts: 7
Post Re: HiTechnic NXT IRReceiver Sensor help
mightor wrote:
Download the driver suite from the link in my signature and take a look at the hitechnic-irrecv-test1.c program. It will explain to you how to use this sensor.

Make sure you are using ROBOTC 3.51 or later.

- Xander


Hi Xander,

it really doesn't make any sense to me as a complete noob, as I said I'm very new to this... How do I connect left/right steering to the left/right wheel and some speed control? Forgive this poor father asking this for his son ;)


Sun Oct 07, 2012 11:19 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: HiTechnic NXT IRReceiver Sensor help
Download and install the latest driver suite, which you can download here: http://botbench.com/blog/robotc-driver-suite/
Be sure to read the tutorial I have on that page, it will help with the installation. Then take a look at some of the examples I have made in the directory with the drivers, specifically the hitechnic-irrecv-test1.c program. You will need to have installed ROBOTC 3.51 or later, or the drivers will not compile.

It is not a trivial task to modify the Segway program to make it do this, just so you know. I also don't know if the Segway is using my old or new drivers (I am not that familiar with the code). If it still using the old drivers, you may want to contact Laurens Valk, who I believe wrote the program.

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]


Sun Oct 07, 2012 11:46 am
Profile WWW
Rookie

Joined: Sat Oct 06, 2012 3:30 am
Posts: 7
Post Re: HiTechnic NXT IRReceiver Sensor help
Ouch...I've installed everything (latest driver suite,robotc 3.51, etc.) everything works fine and the hitechnic-irrecv-test1.c works great. I see what happens on the NXT screen if I turn on the IR transmitter. I´ve looked into the code and tried a lot of things but I really have no idea how to use the example in hitechnic-irrecv-test1.c to control the motors. I just don't see how to use commands like "speed" or "steering" into to this code.
For you it's like daily language but for a new guy it's like chinese. Can you give me some direction to the end of the rainbow?


Sun Oct 07, 2012 2:52 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: HiTechnic NXT IRReceiver Sensor help
Where do you download the segway code from? Do you have a URL for me?

- 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 08, 2012 12:46 am
Profile WWW
Rookie

Joined: Sat Oct 06, 2012 3:30 am
Posts: 7
Post Re: HiTechnic NXT IRReceiver Sensor help
mightor wrote:
Where do you download the segway code from? Do you have a URL for me?

- Xander


Hi, it's the sample code that Laurens Valk wrote. Here is the example "wall Avoidance", I allready replaced the "include drivers" because he was using the old names. I tested it and the segway program works perfect like this with the RobotC 3.51 and the new driver suite. Now I know that I have to remove the"Wall Avoidance" part from this code and replace that for a code that makes it possible to get that HiTechnic receiver working. And just there is my problem. "#include "drivers/hitechnic-irrecv.h" " is also allready on the right place ;)

Thanks for a little help

ps. Link to original files : HERE
Code:
#pragma config(Sensor, S1,     HTIRR,               sensorI2CCustom)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*******INFO*******
Example #1: Segway-Wall-Avoidance.c Wall avoidance program for a LEGO NXT Segway (Includes description of commands to control Segway movement)
Author: Laurens Valk (robotsquare.com)
License: Use the examples as you like, but give credit to the original author. See driver file for more details.
Full instructions: http://robotsquare.com/2012/02/13/tutorial-segway-with-robotc/
***************/

/*CHOOSE A SENSOR: Comment out the sensors that you do not have*/
//#define HiTechnic_Gyro
#define DexterIndustries_dIMU
//#define MicroInfinity_Cruizcore

/*SELECT SENSOR PORT (S1, S2, S3 or S4), and WHEEL DIAMETER (milimeters).*/
const tSensors Gyro = S2;
const float your_wheel_diameter = 84;

/*These are driver files to read gyro sensors. Make sure the path is correct.
  You may delete these two lines if you use the HiTechnic Gyro*/
#include "drivers/dexterind-imu.h"
#include "drivers/microinfinity-cruizcore.h"
#include "drivers/hitechnic-irrecv.h"
/*This is the Segway Driver code. Place in same directory as this program*/
#include "segway-driver-lv.h"

task main()
{
  StartTask(balancing);
  while(starting_balancing_task){}
  //It's that simple - now go program something cool below!

  /*Here's how to control the Segway.

  MOVING AROUND
  - Adjust <steering> to steer.
        steering = 0  ; //Go Straight
        steering = 10 ; //Turn Right
       steering = 17;  //Turn Right quicklier
        steering = -10; //Turn Left
       etc...

   - Adjust <speed> for moving forward and backwards.
       Its value is the motor power that the robot will attempt to maintain

        speed = 0;     //Stand still
        speed = -20 ; //Go backward at 20% of motor power
       speed = 50;   //Go forward at half of maximum motor power (recommended)
       etc...

    - Adjust <acceleration> to change how quickly your robot will reach a certain speed.

       acceleration = 60; means that if your current speed is -20 and you change it
       to 40, it will take 1 seconds to get to that speed. You don't need to change this
       in your program, just set it once. Setting <acceleration = 60;> is recommended.

  TIPS & TRICKS
  - Don't mess with motor B and C!
  - You can read the motor encoders like you would normally do. Just don't reset them.
  - 'speed' sets the segway motor speed - This means you go faster if you use bigger wheels.
  - If you use those big RCX/Motorcycle wheels, say, greater than 60 mm in diameter, consider
    building a slightly bigger Segway, with better supported wheels and a greater wheelspan.
    That improves balancing a great deal!
   */

   //////////////////////////////////////////////
   //
   // EXAMPLE #1: Wall avoidance

const tSensors Sonar = S4;
   SensorType[Sonar] = sensorSONAR;

   acceleration = 60;
   steering = 0;
   wait1Msec(3000);//We wait three seconds just to be sure we're up and running
   PlaySound(soundBeepBeep);

   speed = 50;

   //Every 100 ms, we check if the sensor has spotted anything closer than 60 cm.
   //When so, the robot goes backwards, turns, and continues its way. Note how the
   //speed and steering variables are used to manipulate the robot's movement.

   while(true)
   {
     if(SensorValue[Sonar] < 60)
     {
       speed = -50;
       wait1Msec(2000);
       speed = 0;
       wait1Msec(500);
       steering = 10;
       wait1Msec(1000);
       steering = 0;
       speed = 50;
     }
     wait1Msec(100);
   }
}


Mon Oct 08, 2012 1:56 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: HiTechnic NXT IRReceiver Sensor help
I'll take a look at this today. Yesterday was spent preparing the release of version 3.0 of my driver suite :)

- 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]


Tue Oct 09, 2012 1:34 am
Profile WWW
Rookie

Joined: Sat Oct 06, 2012 3:30 am
Posts: 7
Post Re: HiTechnic NXT IRReceiver Sensor help
Hi Xander,

thanks for looking into this :), you help me a lot with this.

Sander


Tue Oct 09, 2012 3:25 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: HiTechnic NXT IRReceiver Sensor help
I was completely stuck on this and I let Laurens known. There's something in ROBOTC 3.51 that makes it work a bit differently, I think he's looking into it :)

- 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]


Tue Oct 09, 2012 3:37 pm
Profile WWW
Rookie

Joined: Sat Oct 06, 2012 3:30 am
Posts: 7
Post Re: HiTechnic NXT IRReceiver Sensor help
Thanks, could you keep me updated about this?

And what do you mean you were "completely stuck on this", do you mean how the Segway steering is controlled or is the HTIRR control significant different in RobotC 3.51?


Wed Oct 10, 2012 2:36 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: HiTechnic NXT IRReceiver Sensor help
No, I couldn't make it work because I didn't completely understand the segway program :)

- 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 Oct 10, 2012 4:35 am
Profile WWW
Rookie

Joined: Sat Oct 06, 2012 3:30 am
Posts: 7
Post Re: HiTechnic NXT IRReceiver Sensor help
Any news on this yet? :programmer:


Thu Oct 18, 2012 1:03 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: HiTechnic NXT IRReceiver Sensor help
I am currently at a LEGO event and won't be back until Monday evening. I will try to have a look some time next week.

- 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]


Sun Oct 21, 2012 4:49 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.