[SOLVED] Footbot Gripper Actuator

Requests regarding how to set up experiments in ARGoS.
mallwright
Posts: 35
Joined: Tue Apr 17, 2012 11:15 am

[SOLVED] Footbot Gripper Actuator

Postby mallwright » Fri May 25, 2012 11:59 am

I'm currently trying to implement an experiment using the Footbot gripper.

I have added the grippers sensor and actuator to the XML, added and initialised the references to my footbot_clustering controller (as follows) and have run the experiment.

m_pcGripperActuator = dynamic_cast<CCI_FootBotGripperActuator*>(GetRobot().GetActuator("footbot_gripper" ));
m_pcGripperSensor = dynamic_cast<CCI_FootBotGripperSensor* >(GetRobot().GetSensor ("footbot_gripper" ));

On studying the code, I can see that all of the methods for the actuator in turn call the SetAperture(const CRadians& c_aperture) method. However this method is pure virtual, and as far as I can tell has not yet been implemented anywhere. This is confusing, because when build my controller, which contains the function call 'm_pcGripperActuator->Unlock();' (which in turn calls SetAperture), with CMake, it compiles!?

so I must be missing something here, as I thought that a class with pure virtual functions couldn't be instantiated in the first place... so unless it was created from some other object and then dynamically cast to the abstract class, well I'm not familiar what the rules of C++ are there...

So I suppose my question is, to what extent has this plugin been developed and how much more work is required before it is usable?

For the sake of context which may be relevant, I'm trying to implement a clustering experiment in which the footbots move the movable blocks into clusters (see attached snapshot of the arena).
Attachments
env.png
POVRay render of arena for clustering experiment
env.png (181.87 KiB) Viewed 23201 times

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Footbot Gripper Actuator

Postby pincy » Fri May 25, 2012 12:09 pm

The SetAperture() method is pure virtual in the control interface, true. But it is implemented for the simulated robot in argos2/simulator/actuators/foot-bot/footbot_gripper_actuator.h/.cpp. A factory creates the latter class, which is an extension of that in the control interface. In the controller, to be portable to real platforms, you don't see the details of the real robot or simulated implementation. You just see the interface.

Regarding gripping itself, to the best of my knowledge it works well. We have a couple of pretty complex foraging experiments based on it. The only potential problems may be due to parameters such as the mass of the objects to collect, but if you put in reasonable values (100g/1kg/5kg) you should have no problem.
I made ARGoS.

mallwright
Posts: 35
Joined: Tue Apr 17, 2012 11:15 am

Re: Footbot Gripper Actuator

Postby mallwright » Fri May 25, 2012 1:33 pm

Thanks for the fast reply Pincy, I'll look into that header file and see if I can get some better insights.

All best,

Mike

mallwright
Posts: 35
Joined: Tue Apr 17, 2012 11:15 am

Re: Footbot Gripper Actuator

Postby mallwright » Sun May 27, 2012 1:02 pm

Hi Pincy,

I have been doing some more work with the gripper, however I think my approach might be a bit off as when ever I make a call to the LockPositive or LockNegative function of the gripper, ARGoS crashes with an error from the chipmunk physics engine:

Aborting due to Chipmunk error: This addition/removal cannot be done safely during a call to cpSpaceStep() or during a query. Put these calls into a post-step callback.
Failed condition: !space->locked
Source:/home/allsey87/Desktop/Workspace/ARGoS/simulator/physics_engines/dynamics2d/chipmunk-physics/src/cpSpace.c:301
Aborted (core dumped)

In my experiment file (xml) I instantiate a single footbot behind a single block and tell the footbot to drive straight forwards until it gets sufficiently close to the block.

This is the code from the control step function for my controller (note: this is only testbench code, I would implement a proper FSM in an actual design)

Code: Select all

void CFootBotTestbench::ControlStep() { static int state = 1; /* Get readings from proximity sensor */ const CCI_FootBotProximitySensor::TReadings& tProxReads = m_pcProximity->GetReadings(); /* Take a reading from the gripper sensor */ const CCI_FootBotGripperSensor::SReading & sGripperReading = m_pcGripperSensor->GetReading(); const CCI_FootBotGripperSensor::EGripPhase & sGripperPhase = m_pcGripperSensor->GetGripPhase(); /* Set LED colors */ m_pcLEDs->SetAllColors(CColor::BLACK); if(sGripperPhase == CCI_FootBotGripperSensor::OBJECT_NOT_GRIPPED) { m_pcLEDs->SetAllColors(CColor::BLUE); } else if(sGripperPhase == CCI_FootBotGripperSensor::CHECK_IN_PROGRESS) { m_pcLEDs->SetAllColors(CColor::RED); } else if(sGripperPhase == CCI_FootBotGripperSensor::OBJECT_GRIPPED) { m_pcLEDs->SetAllColors(CColor::GREEN); } switch(state) { case 1: m_pcWheels->SetLinearVelocity(0.0, 0.0); m_pcGripperActuator->Unlock(); state = 2; break; case 2: if(sGripperPhase == CCI_FootBotGripperSensor::OBJECT_NOT_GRIPPED) state = 3; break; case 3: m_pcWheels->SetLinearVelocity(m_fWheelVelocity, m_fWheelVelocity); if(tProxReads[0].Value > 0.1) state = 4; break; case 4: m_pcWheels->SetLinearVelocity(0.0, 0.0); m_pcGripperActuator->LockNegative(); state = 5; break; default: break; } }
Any thoughts to what is causing this error, or what I must do to make chipmunk happy?

Cheers,

Michael

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Footbot Gripper Actuator

Postby pincy » Wed May 30, 2012 5:01 pm

Hi,

I fixed that bug in the version of May 21st. It's not really a bug, just a warning that becomes an error when ARGoS is run in debug mode. Anyway, now it's fixed.

Carlo
I made ARGoS.


Return to “How to... ?”