ROBOTC.net forums
http://www.robotc.net/forums/

Has EV3 I2C for 3rd party sensors been fixed?
http://www.robotc.net/forums/viewtopic.php?f=41&t=10007
Page 1 of 2

Author:  cheechr1 [ Sat Dec 13, 2014 1:42 pm ]
Post subject:  Has EV3 I2C for 3rd party sensors been fixed?

Just wondering if 3rd Party Sensors drivers(eg IR Seeker V2, HT IRDIST) have been updated to work with the EV3?

Author:  mightor [ Wed Dec 24, 2014 11:24 am ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Yes :) I just need to tweak the driver suite a bit to make it work a little more smoothly.

= Xander

Author:  Sigtrygg [ Tue Jan 06, 2015 1:18 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Hello Xander!

I want to make a Robot with EV3 and HT compass and Dexter GPS. Did you make the Drivers for them already?
And if yes, where can I download them?

Best regards,

Sigtrygg

Author:  mightor [ Wed Jan 07, 2015 3:03 am ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

The 3rd party sensor driver has not been fully tested yet with the EV3. Some drivers work fine, I have tested several. Others are still exhibiting issues. The functions in ROBOTC, however, work fine :)

Any updated I make, will be put on the Github repository here: https://github.com/botbench/robotcdriversuite

= Xander

Author:  Sigtrygg [ Wed Jan 07, 2015 4:25 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Thank you for your quick answer!

The new concept with the struct variables and equal commands is very good.
I defined my sensor "HTCompass" and are able to apply commands like initSensor(&HTCompass, S1), readSensor(&HTCompass), sensorCalibrate(&HTCompass), sensorStopCalibrate(&HTCompass) and can use values like HTCompass.relativeHeading, HTCompass.heading but I can't find the command for setting the target heading. I don't understand how the relative target is calculated without setting the target heading.

Maybe you can help me?

Best regards,

Sigtrygg

Author:  mightor [ Thu Jan 08, 2015 5:40 am ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Without the target heading, it is not possible to calculate the relative heading without a target. You can set the target to whatever you'd like. I've put the code below that show you how to do it. This is also found in hitechnic-compass-test1.c.

Code:
/**
 * hitechnic-compass.h provides an API for the HiTechnic Compass Sensor.  This program
 * demonstrates how to use that API.
 *
 * Changelog:
 * - 0.1: Initial release
 * - 0.2: More comments
 *
 * License: You may use this code as you wish, provided you give credit where it's due.
 *
 * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 4.10 AND HIGHER

 * Xander Soldaat (xander_at_botbench.com)
 * 25 November 2009
 * version 0.2
 */

#include "hitechnic-compass.h"

task main () {
  displayCenteredTextLine(0, "HiTechnic");
  displayCenteredBigTextLine(1, "Compass");
  displayCenteredTextLine(3, "Test 1");
  displayTextLine(5, "Press enter");
  displayTextLine(6, "to set target");

  sleep(2000);
  eraseDisplay();

  // Create struct to hold sensor data
  tHTMC compass;

  // Initialise and configure struct and port
  initSensor(&compass, S1);

  time1[T1] = 0;
  while(true) {
    // Reset the target no more than once a second
    // This also helps with debouncing the [enter] button.
    if (time1[T1] > 1000) {
      eraseDisplay();
      displayTextLine(1, "Changing");
      displayTextLine(2, "target");
      sleep(500);

      // Read the data from the sensor
      readSensor(&compass);

      // Set the current heading as the value for the offset to be used as the
      // new zero-point for the relative heading returned by
      // compass.relativeHeading
      compass.offset = compass.heading;

      playSound(soundBlip);
      while(bSoundActive) sleep(1);
      time1[T1] = 0;
    }

    // Get the true heading and relative heading from the sensor and
    // display them on the screen.
    while(!getXbuttonValue(xButtonEnter)) {
       // Read the data from the sensor
      readSensor(&compass);
      eraseDisplay();
      displayTextLine(1, "Reading");
      displayTextLine(2, "Target: %4d", compass.offset);
      displayTextLine(4, "Abs:   %4d", compass.heading);
      displayTextLine(5, "Rel:   %4d", compass.relativeHeading);
      displayTextLine(6, "Press enter");
      displayTextLine(7, "to set target");
      sleep(100);
    }
  }
}

Author:  Sigtrygg [ Thu Jan 08, 2015 12:22 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Great! Thank you very much, Xander! :D

I know, it is a lot of work to make all these drivers.

I try to apply this API for my robot and will show the results with code here.

Best regards,

Sigtrygg

Author:  Sigtrygg [ Fri Jan 09, 2015 2:10 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Hello Xander!

I have tried the hitechnic-compass.c example with hitechnic-compass.h and common.h, but it didn't work with my robot. :-(
And although I have defined the compass sensor as I2CCustom it is shown as I2CGenericEV3 into the debug sensor window.
The compass shows once values and then it blocks completely.
I can't explain that. Do you have a hint for me? I added two screencopies with debug stream and settings.

Best regards,

Sigtrygg

Attachments:
picture2.png
picture2.png [ 272.66 KiB | Viewed 19813 times ]
picture1.png
picture1.png [ 239.57 KiB | Viewed 19813 times ]

Author:  Sigtrygg [ Sat Jan 10, 2015 11:47 am ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Hello Xander!

I guess my EV3-brick doesn't work.
I tried the compass with the LEGO-Software and it blocked, too.
Then I tried the sonar sensor with the same result.

I bought the brick from ebay. Don't waste your time and please forget my last post!!!!

Author:  Sigtrygg [ Sat Jan 10, 2015 2:04 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Oh! The brick is o.k!

I tried HT compass sensor and sonar sensor with LEGO Software and it works.
I made a mistake because I never used this Software.
Sorry for confusion!

So, why doesn't work the compass sensor with my RobotC??
Is there anybody who has the same Problems?

Bye,
Sigtrygg

Author:  mightor [ Sun Jan 11, 2015 11:58 am ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Hey there,

I just tested my HT Compass sensor with my EV3 using the latest internal version of the drivers and it works very nicely.

I will do a bit more testing and then I'll commit to the Github repo where you can download it :)

= Xander

Attachments:
Screenshot at 16-56-51.png
Screenshot at 16-56-51.png [ 214.49 KiB | Viewed 19718 times ]

Author:  mightor [ Sun Jan 11, 2015 12:08 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

All done, get your fresh copy from: https://github.com/botbench/robotcdriversuite

There will still be bugs and a LOT more testing is needed, but the compass sensor works and the code to make that happen is fairly cross platform. I need to check the other drivers too, I haven't had a chance to do that yet :)

= Xander

Author:  Sigtrygg [ Sun Jan 11, 2015 1:55 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Hello Xander!

Thank you very much for your support!! :bigthumb:
The compass is running very well, now!
I hope, I can introduce my new robot project, soon. But there is still a lot to do for me.

Best regards,

Sigtrygg

Author:  giuseppe.fava [ Thu Jan 15, 2015 12:14 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Hi everyone (sorry for my poor english... I'm italian)
I'm trying to run a simple program for hitechnic IR Seeker V2 in my new EV3, but I got error

Code:
**Error**:Undefined variable 'i2cStatusStopped'. 'short' assumed.


I'm using RobotC 4.27 with latest version of robotcdriversuite-master

this is my program

Code:
#pragma config(Sensor, S2,     SENS_SEEKER,    sensorEV3_GenericI2C)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "hitechnic-irseeker-v2.h"

task main()
{
    while (true) {
   displayCenteredTextLine ( 2, "SEEKER value: %d", SensorValue[SENS_SEEKER]);
   }
}


where am I wrong?

Author:  mightor [ Thu Jan 15, 2015 12:39 pm ]
Post subject:  Re: Has EV3 I2C for 3rd party sensors been fixed?

Please update to 4.28: http://www.robotc.net/blog/2014/12/23/r ... 4-28-beta/

= Xander

Page 1 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/