Skip to content

Commit

Permalink
examples: added rangefinder example
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Jan 12, 2024
1 parent e76dc5d commit 916a1f3
Show file tree
Hide file tree
Showing 2 changed files with 790 additions and 0 deletions.
39 changes: 39 additions & 0 deletions examples/RangeFinder/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

CANARD_BASE=../..

CC=gcc
CFLAGS = -g -Wall -Idsdl_generated/include -I$(CANARD_BASE) -I$(CANARD_BASE)/drivers/linux

LIBS=$(CANARD_BASE)/canard.c -lm

# add socketcan and multicast drivers for linux
LIBS+=$(CANARD_BASE)/drivers/socketcan/socketcan.c
LIBS+=$(CANARD_BASE)/drivers/mcast/mcast.c
LIBS+=$(CANARD_BASE)/drivers/linux/linux.c

# add in generated code
LIBS+=dsdl_generated/src/uavcan.protocol.NodeStatus.c
LIBS+=dsdl_generated/src/uavcan.protocol.GetNodeInfo_res.c
LIBS+=dsdl_generated/src/uavcan.equipment.range_sensor.Measurement.c
LIBS+=dsdl_generated/src/uavcan.protocol.dynamic_node_id.Allocation.c
LIBS+=dsdl_generated/src/uavcan.protocol.param.GetSet_req.c
LIBS+=dsdl_generated/src/uavcan.protocol.param.GetSet_res.c
LIBS+=dsdl_generated/src/uavcan.protocol.param.ExecuteOpcode_req.c
LIBS+=dsdl_generated/src/uavcan.protocol.param.ExecuteOpcode_res.c

all: rangefinder

DSDL:
git clone --depth 1 https://github.com/DroneCAN/DSDL

dronecan_dsdlc:
git clone --depth 1 https://github.com/DroneCAN/dronecan_dsdlc

dsdl_generated: DSDL dronecan_dsdlc
python3 dronecan_dsdlc/dronecan_dsdlc.py -O dsdl_generated DSDL/dronecan DSDL/uavcan DSDL/com DSDL/ardupilot

rangefinder: dsdl_generated rangefinder.c $(LIBS)
$(CC) -o rangefinder rangefinder.c $(LIBS) $(CFLAGS)

clean:
rm -rf rangefinder DSDL dsdl_generated dronecan_dsdlc
Loading

0 comments on commit 916a1f3

Please sign in to comment.