Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CollisionAvoider.h « GCodes « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a8fda29e85a6435c89d8dd0baa44697e93e26047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * CollisionAvoider.h
 *
 *  Created on: 15 Aug 2022
 *      Author: David
 */

#ifndef SRC_GCODES_COLLISIONAVOIDER_H_
#define SRC_GCODES_COLLISIONAVOIDER_H_

#include <RepRapFirmware.h>

#if SUPPORT_ASYNC_MOVES

#include <Movement/RawMove.h>

class CollisionAvoider
{
public:
	CollisionAvoider() noexcept;

	bool IsValid() const noexcept;
	int GetLowerAxis() const noexcept { return lowerAxis; }
	int GetUpperAxis() const noexcept { return upperAxis; }
	float GetMinSeparation()const noexcept { return minSeparation; }

	// Reset the position accumulators
	void ResetPositions(const float positions[]) noexcept;

	// If the new move doesn't risk a collision, update the position accumulators and return true; else return false
	bool UpdatePositions(const float axisPositions[]) noexcept;

	// Set the parameters
	void Set(int axisL, int axisH, float sep, const float positions[]) noexcept;

private:
	float minSeparation;
	float lowerAxisMax;
	float upperAxisMin;
	int lowerAxis;
	int upperAxis;
};

#endif

#endif /* SRC_GCODES_COLLISIONAVOIDER_H_ */