File: experimental.create3.robdef

package info (click to toggle)
robotraconteur 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 101,380 kB
  • sloc: cpp: 1,149,268; cs: 87,653; java: 58,127; python: 26,897; ansic: 356; sh: 152; makefile: 90; xml: 51
file content (62 lines) | stat: -rw-r--r-- 1,769 bytes parent folder | download
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

#Service to provide sample interface to the iRobot Create
#This example is for the original iRobot Create using the serial Open Interface (OI) protocol
service experimental.create3

stdver 0.10

enum CreateStateFlags
	unknown = 0,
	bump_right = 0x1,
	bump_left = 0x2,
	wheel_drop_right = 0x4,
	wheel_drop_left = 0x8,
	wheel_drop_caster = 0x10,
	wall_sensor = 0x20,
	cliff_left = 0x40,
	cliff_front_left = 0x80,
	cliff_front_right = 0x100,
	cliff_right = 0x200,
	virtual_wall = 0x400,
	play_button = 0x800,
	advance_button = 0x1000,
	error = 0x800000
end

struct CreateState
	field double time
	field uint32 create_state_flags
	field double velocity
	field double radius
	field double right_wheel_velocity
	field double left_wheel_velocity
	field double distance_traveled
	field double angle_traveled
	field double battery_charge
	field double battery_capacity
end

object Create
	constant double DRIVE_STRAIGHT 32.767
	constant double SPIN_CLOCKWISE -1e-3
	constant double SPIN_COUNTERCLOCKWISE 1e-3

	function void drive(double velocity, double radius)
	function void drive_direct(double right_wheel_velocity, double left_wheel_velocity)
	function void stop()
	function void setf_leds(bool play, bool advance)

	property double distance_traveled [readonly]
	property double angle_traveled [readonly]
	property uint8 bumpers [readonly]

	event bump()

	wire CreateState create_state [readonly]

	# Callback to be called when the play button is pressed
	# claim_play_callback() will assign the current client as the target for the callback
	# Practical implementations will likely want to use a more sophisticated mechanism to assign the callback
	function void claim_play_callback()
	callback uint8[] play_callback(double distance_traveled, double angle_traveled)
end