12 #include "Box2D/Box2D.h" 13 #include "SFML/Graphics.hpp" 14 #include "SFML/Window.hpp" 17 #include "constants.h" 44 Robot(b2World* world,
config::sRobot robotParameters,
double posX,
double posY,
double angle = 0);
59 void drawBody(sf::RenderWindow& window,
double m_to_pix);
64 void drawJoint(sf::RenderWindow& window,
double m_to_px);
146 void grip(b2Contact* contact, b2Body* otherBody,
double m_to_px);
166 bool gripSide(b2Contact* contact, b2Body* otherBody,
double m_to_px);
169 bool contactOnGripSide(b2Contact* contact);
270 side m_movingSide = RIGHT;
271 bool m_ready =
false;
272 bool m_moving =
false;
275 bool m_pushing =
false;
276 bool m_isGrabbed =
false;
277 double m_referenceAngle = -PI ;
278 double m_referenceAngleJoint = 0 ;
282 int m_pushing_delay = 0;
288 b2PrismaticJoint* m_currentGripJoint =
nullptr;
294 double m_angularSpeed = 2*PI;
299 b2Body* m_rightWheel;
304 b2RevoluteJoint* m_rightWheelMotor;
305 b2RevoluteJoint* m_leftWheelMotor;
308 bool m_contact =
false;
315 b2PrismaticJointDef m_leftGripJointDef;
316 b2PrismaticJointDef m_rightGripJointDef;
318 int m_nbJointLeft = 0;
319 int m_nbJointRight = 0;
325 sf::CircleShape m_shapeRight;
326 sf::CircleShape m_shapeLeft;
327 sf::CircleShape m_shape3;
328 sf::Vertex m_normal[2];
void drawGripJoint(sf::RenderWindow &window, double m_to_px)
void drawJoint(sf::RenderWindow &window, double m_to_px)
void allowMotorRotation(side s)
void setSpeed(double speed)
void blockMotorRotation(side s)
Implementation of the Configuration class used to parse the configuration file and the sConfig struct...
b2PrismaticJointDef getJointDef(side s)
b2Body * getWheel(side s)
void moveBodyWithImpulse()
void limitMotorRotation(side s, double limit_angle_rad)
void createBody(b2World *world, config::sRobot m_robotParameters, double posX, double posY, double angle=0)
void resetNbJoint(side s)
void grip(b2Contact *contact, b2Body *otherBody, double m_to_px)
void incrementNbJoint(side s)
void setContact(bool contact)
b2RevoluteJoint * getMotor(side s)
bool gripSide(b2Contact *contact, b2Body *otherBody, double m_to_px)
void drawBody(sf::RenderWindow &window, double m_to_pix)
void setState(e_state state)
b2PrismaticJoint * m_previousGripJoint
void turnOffMotor(side s)