Crazyflie compatibility
This commit is contained in:
		
							parent
							
								
									a7020364d1
								
							
						
					
					
						commit
						733a09ce91
					
				| @ -3,6 +3,8 @@ | |||||||
| #include "DistanceSensor.h" | #include "DistanceSensor.h" | ||||||
| #include "Switch.h" | #include "Switch.h" | ||||||
| 
 | 
 | ||||||
|  | #include <math.h> | ||||||
|  | 
 | ||||||
| Perception::Perception() {} | Perception::Perception() {} | ||||||
| 
 | 
 | ||||||
| Perception::Perception(Placement* sensors, unsigned int sensorCount) { | Perception::Perception(Placement* sensors, unsigned int sensorCount) { | ||||||
| @ -209,7 +211,8 @@ Sensor* Perception::GetSensor(float angle) { | |||||||
| 
 | 
 | ||||||
|   for (unsigned int ix = 0; ix < this->sensorCount; ix++) { |   for (unsigned int ix = 0; ix < this->sensorCount; ix++) { | ||||||
|     Placement placement = this->sensorPlacements[ix]; |     Placement placement = this->sensorPlacements[ix]; | ||||||
|     if (abs(placement.horizontalDirection - angle) < 0.01F) |     float delta = placement.horizontalDirection - angle; | ||||||
|  |     if (delta > -0.01F && delta < 0.01F) | ||||||
|       return (Sensor*)placement.thing; |       return (Sensor*)placement.thing; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -2,8 +2,6 @@ | |||||||
| 
 | 
 | ||||||
| #include "FloatSingle.h" | #include "FloatSingle.h" | ||||||
| 
 | 
 | ||||||
| #include <Arduino.h> |  | ||||||
| 
 |  | ||||||
| Propulsion::Propulsion() { | Propulsion::Propulsion() { | ||||||
|   this->placement = nullptr; |   this->placement = nullptr; | ||||||
|   this->motorCount = 0; |   this->motorCount = 0; | ||||||
| @ -57,7 +55,9 @@ void Propulsion::Update(float currentTimeMs) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Propulsion::SetMaxSpeed(float maxSpeed) { | void Propulsion::SetMaxSpeed(float maxSpeed) { | ||||||
|   this->maxSpeed = abs(maxSpeed); |   if (maxSpeed < 0) | ||||||
|  |     maxSpeed = 0; | ||||||
|  |   this->maxSpeed = maxSpeed; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Propulsion::SetTwistSpeed(float forward, float yaw) {} | void Propulsion::SetTwistSpeed(float forward, float yaw) {} | ||||||
|  | |||||||
| @ -1,5 +1,4 @@ | |||||||
| #include "Roboid.h" | #include "Roboid.h" | ||||||
| #include <Arduino.h> |  | ||||||
| 
 | 
 | ||||||
| Roboid::Roboid() {} | Roboid::Roboid() {} | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								Switch.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Switch.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | #include <Switch.h> | ||||||
|  | 
 | ||||||
|  | Switch::Switch() {} | ||||||
|  | 
 | ||||||
|  | bool Switch::IsOn() { | ||||||
|  |   return false; | ||||||
|  | } | ||||||
							
								
								
									
										18
									
								
								Switch.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Switch.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | |||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include "Sensor.h" | ||||||
|  | 
 | ||||||
|  | namespace Passer { | ||||||
|  | namespace RoboidControl { | ||||||
|  | 
 | ||||||
|  | /// @brief A digital switch input
 | ||||||
|  | class Switch : public Sensor { | ||||||
|  |  public: | ||||||
|  |   /// @brief Default constructor
 | ||||||
|  |   Switch(); | ||||||
|  | 
 | ||||||
|  |   virtual bool IsOn(); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | }  // namespace RoboidControl
 | ||||||
|  | }  // namespace Passer
 | ||||||
| @ -1 +1 @@ | |||||||
| Subproject commit 006ea046e4bb57b033823ba5a3fad0dfc7f5dfba | Subproject commit 493a3f748907b4fb7e64177f94b7cb98a951af4c | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Pascal Serrarens
						Pascal Serrarens