vb.net sample code for Module RM-G146

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
8 postsPage 1 of 1
8 postsPage 1 of 1

vb.net sample code for Module RM-G146

Post by goldpower » Wed Jul 03, 2013 3:29 pm

Post by goldpower
Wed Jul 03, 2013 3:29 pm

hi

how do modify vb.net sample code for Module RM-G146 ???
(http://www.roboard.com/G146.html)
hi

how do modify vb.net sample code for Module RM-G146 ???
(http://www.roboard.com/G146.html)
goldpower offline
Newbie
Newbie
Posts: 5
Joined: Tue Dec 11, 2012 9:16 pm

Post by goldpower » Sun Jul 07, 2013 4:40 pm

Post by goldpower
Sun Jul 07, 2013 4:40 pm

help help help ...
help help help ...
goldpower offline
Newbie
Newbie
Posts: 5
Joined: Tue Dec 11, 2012 9:16 pm

Post by PaulL » Sun Jul 07, 2013 5:37 pm

Post by PaulL
Sun Jul 07, 2013 5:37 pm

More information is needed. What are you trying to do?
More information is needed. What are you trying to do?
PaulL offline
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Post by goldpower » Sun Jul 07, 2013 10:52 pm

Post by goldpower
Sun Jul 07, 2013 10:52 pm

I only know the VB.NET language And I do not know the C++ language.

(The sensor 146 I've tested the sample code c++ because it does not suffer from the negative axis accelerometer values ​​and only values ​​from 0 to 65535?)
I only know the VB.NET language And I do not know the C++ language.

(The sensor 146 I've tested the sample code c++ because it does not suffer from the negative axis accelerometer values ​​and only values ​​from 0 to 65535?)
goldpower offline
Newbie
Newbie
Posts: 5
Joined: Tue Dec 11, 2012 9:16 pm

Post by PaulL » Mon Jul 08, 2013 2:45 am

Post by PaulL
Mon Jul 08, 2013 2:45 am

What are you connecting this board to?

I haven't tried this board, but it's an I2C board, so it connects the same way as any I2C board.

I'm getting an error saying corrupted zip file when I try to download their code for this module.,,

As for the accelerometer values:

The "at rest" position will be some value between 0 and 65535 (16 bits). This value becomes your zero point, if you want to see acceleration as positive and negative values (meaning, Current Value - "at rest" value = zero referenced result).
What are you connecting this board to?

I haven't tried this board, but it's an I2C board, so it connects the same way as any I2C board.

I'm getting an error saying corrupted zip file when I try to download their code for this module.,,

As for the accelerometer values:

The "at rest" position will be some value between 0 and 65535 (16 bits). This value becomes your zero point, if you want to see acceleration as positive and negative values (meaning, Current Value - "at rest" value = zero referenced result).
PaulL offline
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Post by goldpower » Mon Jul 08, 2013 5:34 am

Post by goldpower
Mon Jul 08, 2013 5:34 am

yes.

sample code c++ :
http://www.mediafire.com/download/13y5jma624vvw3c/RM-G146_sample_code.zip

Datasheet LSM303DLH :
http://www.mediafire.com/download/at2gb231kdxk1jo/LSM303DLH.pdf

Please explain more about negative values ​​axes.

sample code c++ for values ​​from 0 to 65535
Code: Select all
#include <stdio>
#include <conio>

#if defined(WIN32)
    #include <roboard_dll>  // use the DLL version of RoBoIO lib
    // #include <roboard>   // use the static version of RoBoIO lib
#else
    #include <roboard>
#endif

const unsigned char acceler_addr = 0x30>>1;

int main()
{
   unsigned int acceler_X, acceler_Y, acceler_Z, d;
   
   roboio_SetRBVer(RB_110);
   
    if (i2c_Initialize(I2CIRQ_DISABLE) == false)
   {
      printf("FALSE!!  %s\n", roboio_GetErrMsg());
      return -1;
   }
   
   i2c0_SetSpeed(I2CMODE_AUTO, 400000L); // set i2c speed:400k
   // set acceler
   if(i2c0master_StartN(acceler_addr, I2C_WRITE,2) == false)
   {
      printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
      goto END;
   }
   i2c0master_WriteN(0x20);
   i2c0master_WriteN(0x37);

      do
   {
      //////////////////////////////////////////////////////////////////////// read acceler_X
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x29) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((acceler_X = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_X = acceler_X << 8;
      
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x28) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((d = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_X = acceler_X + d;
      
      //////////////////////////////////////////////////////////////////////// read acceler_Y
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x2b) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((acceler_Y = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_Y = acceler_Y << 8;
      
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x2a) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((d = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_Y = acceler_Y + d;
      
      //////////////////////////////////////////////////////////////////////// read acceler_Z
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x2d) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((acceler_Z = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_Z = acceler_Z << 8;
      
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x2c) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((d = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_Z = acceler_Z + d;

   
      printf("acceler:X-axis:%d Y-azis:%d Z-axis:%d\n\n",acceler_X, acceler_Y, acceler_Z);
      
      delay_ms(10);
   }while(_getch() != 27);
END:
   i2c_Close();
   return 0;
}
yes.

sample code c++ :
http://www.mediafire.com/download/13y5jma624vvw3c/RM-G146_sample_code.zip

Datasheet LSM303DLH :
http://www.mediafire.com/download/at2gb231kdxk1jo/LSM303DLH.pdf

Please explain more about negative values ​​axes.

sample code c++ for values ​​from 0 to 65535
Code: Select all
#include <stdio>
#include <conio>

#if defined(WIN32)
    #include <roboard_dll>  // use the DLL version of RoBoIO lib
    // #include <roboard>   // use the static version of RoBoIO lib
#else
    #include <roboard>
#endif

const unsigned char acceler_addr = 0x30>>1;

int main()
{
   unsigned int acceler_X, acceler_Y, acceler_Z, d;
   
   roboio_SetRBVer(RB_110);
   
    if (i2c_Initialize(I2CIRQ_DISABLE) == false)
   {
      printf("FALSE!!  %s\n", roboio_GetErrMsg());
      return -1;
   }
   
   i2c0_SetSpeed(I2CMODE_AUTO, 400000L); // set i2c speed:400k
   // set acceler
   if(i2c0master_StartN(acceler_addr, I2C_WRITE,2) == false)
   {
      printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
      goto END;
   }
   i2c0master_WriteN(0x20);
   i2c0master_WriteN(0x37);

      do
   {
      //////////////////////////////////////////////////////////////////////// read acceler_X
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x29) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((acceler_X = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_X = acceler_X << 8;
      
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x28) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((d = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_X = acceler_X + d;
      
      //////////////////////////////////////////////////////////////////////// read acceler_Y
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x2b) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((acceler_Y = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_Y = acceler_Y << 8;
      
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x2a) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((d = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_Y = acceler_Y + d;
      
      //////////////////////////////////////////////////////////////////////// read acceler_Z
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x2d) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((acceler_Z = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_Z = acceler_Z << 8;
      
      if(i2c0master_StartN(acceler_addr, I2C_WRITE,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_WriteN(0x2c) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if(i2c0master_StartN(acceler_addr, I2C_READ,1) == false)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      if((d = i2c0master_ReadN()) == 0xffff)
      {
         printf("g-sensor error:%s !!\n",roboio_GetErrMsg());
         goto END;
      }
      acceler_Z = acceler_Z + d;

   
      printf("acceler:X-axis:%d Y-azis:%d Z-axis:%d\n\n",acceler_X, acceler_Y, acceler_Z);
      
      delay_ms(10);
   }while(_getch() != 27);
END:
   i2c_Close();
   return 0;
}
goldpower offline
Newbie
Newbie
Posts: 5
Joined: Tue Dec 11, 2012 9:16 pm

Post by PaulL » Sat Jul 27, 2013 7:12 am

Post by PaulL
Sat Jul 27, 2013 7:12 am

I saw your other post. I'll try to re-explain:

At rest, when sitting still, you will get some value from X, Y, and Z. To generate + and - values relative to rest position, do this:

RelativeValueX = CurrentX - AtRestX

RelativeValueX will be + when axis is greater than AtRestX, and - when axis is less than AtRestX.

Do the same for Y and Z.

All accelerometers exhibit some value when at rest, as gravity is always affecting them. An axis perfectly perpendicular to the force of gravity and not moving should be zero, but it is unlikely you'll actually see zero at this position due to fabrication, tolerances, etc. It is sufficient in practice to zero-reference by using "at rest" values.

This is similar to how RC gyros work in helicopters and such, and is why you're supposed to leave the gyro alone for a few seconds when powering on - because it is recording its "at rest" position to use as a reference.
I saw your other post. I'll try to re-explain:

At rest, when sitting still, you will get some value from X, Y, and Z. To generate + and - values relative to rest position, do this:

RelativeValueX = CurrentX - AtRestX

RelativeValueX will be + when axis is greater than AtRestX, and - when axis is less than AtRestX.

Do the same for Y and Z.

All accelerometers exhibit some value when at rest, as gravity is always affecting them. An axis perfectly perpendicular to the force of gravity and not moving should be zero, but it is unlikely you'll actually see zero at this position due to fabrication, tolerances, etc. It is sufficient in practice to zero-reference by using "at rest" values.

This is similar to how RC gyros work in helicopters and such, and is why you're supposed to leave the gyro alone for a few seconds when powering on - because it is recording its "at rest" position to use as a reference.
PaulL offline
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Post by goldpower » Sat Jul 27, 2013 7:53 am

Post by goldpower
Sat Jul 27, 2013 7:53 am

RN1AsOf091407 wrote:I saw your other post. I'll try to re-explain:

At rest, when sitting still, you will get some value from X, Y, and Z. To generate + and - values relative to rest position, do this:

RelativeValueX = CurrentX - AtRestX

RelativeValueX will be + when axis is greater than AtRestX, and - when axis is less than AtRestX.

Do the same for Y and Z.

All accelerometers exhibit some value when at rest, as gravity is always affecting them. An axis perfectly perpendicular to the force of gravity and not moving should be zero, but it is unlikely you'll actually see zero at this position due to fabrication, tolerances, etc. It is sufficient in practice to zero-reference by using "at rest" values.

This is similar to how RC gyros work in helicopters and such, and is why you're supposed to leave the gyro alone for a few seconds when powering on - because it is recording its "at rest" position to use as a reference.


please sample code
RN1AsOf091407 wrote:I saw your other post. I'll try to re-explain:

At rest, when sitting still, you will get some value from X, Y, and Z. To generate + and - values relative to rest position, do this:

RelativeValueX = CurrentX - AtRestX

RelativeValueX will be + when axis is greater than AtRestX, and - when axis is less than AtRestX.

Do the same for Y and Z.

All accelerometers exhibit some value when at rest, as gravity is always affecting them. An axis perfectly perpendicular to the force of gravity and not moving should be zero, but it is unlikely you'll actually see zero at this position due to fabrication, tolerances, etc. It is sufficient in practice to zero-reference by using "at rest" values.

This is similar to how RC gyros work in helicopters and such, and is why you're supposed to leave the gyro alone for a few seconds when powering on - because it is recording its "at rest" position to use as a reference.


please sample code
goldpower offline
Newbie
Newbie
Posts: 5
Joined: Tue Dec 11, 2012 9:16 pm


8 postsPage 1 of 1
8 postsPage 1 of 1