Some questions to ROSbot example

Hello

While implementing my own robot I took a deeper look in the ROSbot example (especially the IMU part - I use a MPU6050) and have some questions:

  • As far as I understand the IMU is connected to hSens2, but there are a few write operations to hSens3. For what they are for? What is connected to hSens3 in ROSbot?
  • Is there a possibility to make the connection to hSens2 variable in the code not a constant in various files?
  • What is the purpose of hGPIO pin5V(91); in IMU.cpp. I assume it switch the power off and on (via write(0) and write(1)). Is this pin especially for hSens2 or is it for all six connectors?

As mentioned earlier it would be great if the API documentation would be updated with the hints from this forum (and additional things :wink:).

Thanks for updating me

Michael

Can you point me to the ROSBot example code that you are using?

The code is from here:
https://github.com/husarion/hFramework/tree/master/src/rosbot and here: https://github.com/husarion/ROSbot_examples.

Michael

Hi Michael,

Calls to hSens3 and hGPIO pin5V(91) are remains of previous version created during development. They are not necessary now and will be removed in further releases of hFramework.

IMU is connected only to hSens2, it can not be affected by hSens3.
Pin hGPIO pin5V(91) is for powering on and off all sensor connectors.

Could you explain what do you mean by:

make the connection to hSens2 variable in the code not a constant in various files

It would be great if you specify more precisely what do you want to achieve.

Regards
Łukasz

Hi Łukasz

thanks for your quick answer.
From your answer I understand that hGPIO pin5V(91) is usable for switching the power of all sensors on and off (which is obviously not senseful in the handling for a special sensor), but may be in the general initialization phase or for a software reset of the robot/all sensors.
I would like to have the sensor as a parameter to the IMU.cpp classes and consequently to all other needed classes (e.g. arduino_mpu9250_i2c.cpp), for using a different sensor port or usage of more than one IMU.

Michael

Hi Michael,

The hSens2 is an instance of a hSensor class. You can pass it to other classes and methods as any other object or variable.

hSens2 is accessible in various files because it is defined with extern keyword here.

ROSbot.cpp, IMU.cpp and other files were prepared only for ROSbot with IMU always attached to hSens2, thus we are using hard-coded hSens2 for accessing IMU. There should be no problem to adapt code to use hSensor class as a parameter.

Regards,
Łukasz

Hi Łukasz
thanks again, I will try.
What about the hGPIO pin5V(91)? Is my assumption correct?

Michael

Yes, Your assumption is correct.