Page 1 of 1

Is there vector 3D definition?

Posted: Wed Feb 27, 2013 2:23 pm
by leloric
Hi everyone,

I am trying to build a controller for eyebot_diffusion from scratch (as it is not included in the examples).
This is so that I can get a feel of how to program my own robots using ARGoS in the future.

In the footbot_diffusion, there is a line that goes:

Code: Select all

/* 2D vector definition */ #include <argos2/common/utility/math/vector2.h>
I am wondering is there a 3D vector definition?
I tried to follow the file link to no avail.

Would appreciate if anyone could confirm this with me.

Thanks :)

Re: Is there vector 3D definition?

Posted: Wed Feb 27, 2013 6:37 pm
by pincy
Hi leloric,

sure there is a definition of the 3D vector, as well as other useful mathematical classes. Everything is installed in /usr/include/argos2/common/utility/math. There's a number of further utility classes and functions in /usr/include/argos2/common/utility.

Ciao!
Carlo

Re: Is there vector 3D definition?

Posted: Fri Mar 01, 2013 5:58 pm
by leloric
Thanks for the reply Carlo.
Struggling through the coding as we speak.
Guess I will continue afte my weekend ...

Need Break!!!

Re: Is there vector 3D definition?

Posted: Fri Mar 01, 2013 8:18 pm
by pincy
You're welcome! Good luck with your code :-)

Re: Is there vector 3D definition?

Posted: Mon Mar 04, 2013 2:44 pm
by leloric
I have a question:

void CFootBotDiffusion::ControlStep() {
/* Get readings from proximity sensor */
const CCI_FootBotProximitySensor::TReadings& tProxReads = m_pcProximity->GetReadings();
&
void CEyeBotDiffusion::ControlStep() {
/* Get readings from distance scanner sensor */
const CCI_EyeBotDistanceScannerSensor::TReadings& tDistReads = m_pcDistance->GetReadings();

Originally, I changed only the parts highlighted in red. Running the make command produced error saying that it does not recognise tProxReads. After searching through all the documents to no avail, I (got inspired and) changed the part highlighted in blue and it ran ok under make command. Could someone explain how tProxReads and tDistReads work, and their differences other than name?

Re: Is there vector 3D definition?

Posted: Mon Mar 04, 2013 3:44 pm
by pincy
I'm not sure I understand the problem. Could you please copy-paste the actual error message you got from make?

Re: Is there vector 3D definition?

Posted: Mon Mar 04, 2013 4:00 pm
by leloric
The error is as follows:

Code: Select all

/home/a9658007/argos2-user/controllers/eyebot_diffusion/eyebot_diffusion.cpp: In member function ‘virtual void CEyeBotDiffusion::ControlStep()’: /home/a9658007/argos2-user/controllers/eyebot_diffusion/eyebot_diffusion.cpp:56:26: error: ‘tProxReads’ was not declared in this scope

Re: Is there vector 3D definition?

Posted: Wed Mar 06, 2013 2:35 pm
by leloric
I have noticed that the eyebot_distance_scanner_sensor.h does not has a distance variable while the footbot_distance_scanner_sensor.h has both angle and distance.

Is it ok to modify the eyebot_distance_scanner_sensor.h to incorporate the distance?
Or is it possible to use the footbot_distance_scanner_sensor.h on the eyebot which I am making?

Re: Is there vector 3D definition?

Posted: Thu Mar 07, 2013 5:19 pm
by leloric
Found out that I cannot modify the codes in common/control_interface.
Used the footbot distance scanner sensor instead.

Could not compile because of the altitude sensor causing problem.

Code: Select all

CEyeBotDiffusion::CEyeBotDiffusion() : m_pcPropellers(NULL), m_pcLEDs(NULL), m_pcAltitude(NULL) << causing problem m_pcDistance(2.5f), m_cAlpha(10.0f), m_fDelta(0.5f), m_cAltitude(0.0f) << causing problem m_fPropellerLinearVelocity(2.5f), m_fPropellerAngularVelocity(2.5f), m_cGoStraightAngleRange(-ToRadians(m_cAlpha), ToRadians(m_cAlpha)) {} /****************************************/ /****************************************/ void CEyeBotDiffusion::Init(TConfigurationNode& t_node) { m_pcPropellers = dynamic_cast<CCI_EyeBotPropellersActuator* >(GetRobot().GetActuator("eyebot_propellers")); m_pcLEDs = dynamic_cast<CCI_EyeBotLedsActuator* >(GetRobot().GetActuator("eyebot_leds")); m_pcAltitude = dynamic_cast<CCI_EyeBotAltitudeSensor* >(GetRobot().GetSensor ("eyebot_altitude")); m_pcDistance = dynamic_cast<CCI_FootBotDistanceScannerSensor*>(GetRobot().GetSensor ("footbot_distance_scanner")); GetNodeAttributeOrDefault(t_node, "alpha", m_cAlpha, m_cAlpha); m_cGoStraightAngleRange.Set(-ToRadians(m_cAlpha), ToRadians(m_cAlpha)); GetNodeAttributeOrDefault(t_node, "delta", m_fDelta, m_fDelta); GetNodeAttributeOrDefault(t_node, "velocity", m_fPropellerLinearVelocity, m_fPropellerAngularVelocity); GetNodeAttributeOrDefault(t_node, "altitude", m_fAltitude); }
Error:

Code: Select all

/home/a9658007/argos2-user/controllers/eyebot_diffusion/eyebot_diffusion.cpp: In constructor ‘CEyeBotDiffusion::CEyeBotDiffusion()’: /home/a9658007/argos2-user/controllers/eyebot_diffusion/eyebot_diffusion.cpp:20:36: error: cannot convert ‘float’ to ‘argos::CCI_FootBotDistanceScannerSensor*’ in initialization
I am confused as to when m_fxxxxx and m_cxxxxxx for my variables.
Greatly in need of advice and help.
Building this alone is truly difficult.

Re: Is there vector 3D definition?

Posted: Thu Mar 21, 2013 4:33 pm
by pincy
You can't modify the interfaces in the common_interface directory, for two reasons. First, because that's the robot control interface - modifying that interface means modifying the way the robot works. Second, because the files are installed system-wide.
Also, you can't use the foot-bot distance scanner with the eye-bot - the two robots are different in reality as well as in simulation.

If you're confused on how to proceed, write me a PM at cpinciro@ulb.ac.be and we can arrange a Skype call.